fix(i18n): load language files before doing anything else #3218
No reviewers
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
3 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#3218
Loading…
Reference in New Issue
No description provided.
Delete Branch "fix/load-language-files"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #3214
This PR fixes the problem mentioned in the issue, but I'm not 100% sure about the cause of it. In simply loading the language before doing anything else, the watcher is only executed once the language files are correctly in the browser. I suspect registering the watcher happens before the app is mounted?
Hi konrad!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://3218-fix-load-language-files--vikunja-frontend-preview.netlify.app
You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.
Have a nice day!
I guess this is because of the vue life cycle.
(with steps in between)
@ -39,74 +39,76 @@ if (window.API_URL.slice(window.API_URL.length - 1, window.API_URL.length) === '
window.API_URL = window.API_URL.slice(0, window.API_URL.length - 1)
}
const app = createApp(App)
Would it work if we save the returned promise of
setLanguage
and load it in parallel to all the stuff until mounting the app?That's how it is done right now, but that does not seem to work.
It looks like the language needs to be loaded before the Vue Lifecycle starts.
Actually tried it again but even got an error here
TypeError: route is undefined
.That's weird. I just tried this myself and couldn't trigger that error.
Unsure if this was the case before, but right now it doesn't load the user language if it's not english for me.
You mena it does not load it at all?
Yes. It's not translated. I have to manually save the user settings again (that show the correct saved language) to trigger the loading of the language.
That's really wired. Is it reproducible on try?
It was in the test branch of this pr. So I guess it should also exist on try.