-
Notifications
You must be signed in to change notification settings - Fork 42
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
Refactoring the web translations #1777
Merged
Merged
+21,001
−57,754
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lslezak
force-pushed
the
i18n_web_refactoring
branch
from
November 21, 2024 23:03
a9efd6a
to
0495fd3
Compare
imobachgs
approved these changes
Nov 27, 2024
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.
Really nice improvement. Just a minor comment. Otherwise, LGTM.
web/src/context/installerL10n.tsx
Outdated
@@ -230,6 +230,30 @@ function InstallerL10nProvider({ children }: { children?: React.ReactNode }) { | |||
reload(newLanguage); | |||
} else { | |||
setLanguage(newLanguage); | |||
|
|||
// load the translations dynamically, first try the language + territory | |||
const po = newLanguage.replace("-", "_"); |
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 possible, I would move this logic to a function so the caller is easy to read.
imobachgs
approved these changes
Nov 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
npm run server
). And unfortunately we cannot share the code because it is Rust vs. Javascript...Solution
Implementation details
po.js
handler from the Agama HTTP serverpo.js
handler from the Webpack development servernull
values into the output.)jed
andgettext-parser
NPM dependencies to the PO->JS converter, that means those NPM packages are installed only when converting the PO files to JS (basically only in the GitHub action which merges them), they are not installed when building the Agama web frontendTesting
TODO
pt_BR
translations which additionally include the country code*.po
file to*.js
into a standalone script (Webpack needs to load the JS files during compilation, the dynamically generated JS files are not found)*.po
files to*.js
during import (the Git repository will contain the already converted*.js
translations instead of the original*.po
Gettext files)