Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[i18n] Load "en" translations parallely #3102
[i18n] Load "en" translations parallely #3102
Changes from 1 commit
b0ab693
855da7b
1738aca
b5c5bde
9b1c64c
42830ff
8b22c87
c5ed4bc
25c89ce
43243d3
737effa
a9235ab
01a4b4e
6c5a54d
2d99656
b11f2b0
e17a308
6c50c83
e30a065
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
from @seancolsen - adding a comment here explaining "why this approach?" since this approach is weird.
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.
Added
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.
This approach seems strange to me. If I understand correctly, in
index.html
we're importing the translation data and sticking it onwindow
. Then here we are looking atwindow
every 100ms to see if it has loaded. This seems really hacky. Why can't we doawait import
and let vite sort it out?I wouldn't expect us to need to deal with
window
. But if we absolutely do, then I'd prefer to use a.d.ts
file to provide our own typings forwindow.translation
instead of the@ts-expect-error
approach here.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.
If we do
await import
vite will downloadApp.svelte
first & then start the download for the translations. The code here enables the parallel download for both of the things.I have added the
translations
object inglobal.d.ts
855da7bThere 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.
With the latest set of changes, this approach of checking the data with setInterval is no longer used.
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.
Can this function be named
loadTranslations
instead? The nameloadTranslationsIntoMemory
throws me off a bit because it's in the same file as other functions which seem to be also loading things into memory but are not named in a similar manner.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.
1738aca