New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement hot reloading for the locale files during development #5050
Implement hot reloading for the locale files during development #5050
Conversation
const message = JSON.parse(event.data) | ||
|
||
if (message.type === 'freetube-locale-update') { | ||
const i18n = document.getElementById('app').__vue__.$i18n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's so much I don't know. This is so cool. Side tip I found from looking this up for @ChunkyProgrammer: the Vue 3 equivalent is apparently __vueParentComponent.ctx
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Implement hot reloading for the locale files during development
Pull Request Type
Description
This pull request implements hot reloading for the locale files. I recommend reviewing this pull request by commit, so that it's easier to understand what changes are related to what.
Currently we have it setup to reload the entire app when a locale file is edited, which is not ideal for multiple reasons, a major one being that we have to load all the data from the databases again like we do at startup and all the caches get cleared.
What is hot reloading?
You know when you edit one of the Vue or JavaScript files and it only reloads the parts of the app that changed, that's hot reloading.
Please keep in mind that not all parts of the app react to changes to the locales, the same bits that don't automatically change when you change the language won't change here either, but you can just use the backwards and forwards arrows in the navigation bar, then which still avoids the full reload.
Testing
The easiest way to test that it works is to edit the
Search / Go to URL: Search / Go to URL
string in the language that you currently have selected, as that is the text that is shown in the search bar at the top of the window that is visible on all pages.Desktop