-
Notifications
You must be signed in to change notification settings - Fork 235
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
Babel integration #1247
Merged
Merged
Babel integration #1247
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
Started the translation process using Poedit. Lines
Update messages.po
First modification (only adding one line here) using Poedit and following the translation steps given by kdmukai. If everything is working well here I am ready to start translating.
Test first modif in ES
Update messages.po
Update messages.po
Start Russian translation
Russian translation 30% complete
Update French to 36%
Update messages.po
Slowly but surely
Russian 70% complete
Update messages.po at 60% - updated
Russian 100% complete
Update French to 44%
Fix double quotes format issue
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.
Note: New pip requirement
pip install Flask-Babel
but I need info on how to generate a newrequirements.txt
that will include the hashes.Overview: Babel will attempt to find a translation for a given wrapped string in the target language. If an entry is not found or is left blank, Babel will just return the English text. So even if there are large holes in the translation file for a target language, we won't have any broken functionality. The worst-case scenario is that the user gets English text, which is no worse than what they're seeing now.
See the new
babel/README.md
for most of the details.Key changes:
config.py
: Defines the supportedLANGUAGES
.server.py
: Defines aSpecterFlask
class so we can add some locale-handling methods to the Flask app. Handles locale auto-detection. New endpoint to make explicit language selections. Initializes Babel to the app instance.helpers.py
,devices.py
: Multi-language support for BIP39 mnemonic wordlists. The library we're using already has all of the wordlists for other languages that are defined in BIP39. Wraps calls toMnemonic
so it can be initialized with the selected language.babel/README.md
: docs to guide volunteer translators as well as explain to devs how to wrap strings in various situations and how to generate and compile the translation files.lazy_gettext
everywhere rather than deciding between it andgettext
. There are some pitfalls when usinggettext
that are solved bylazy_gettext
and I don't see a downside to just always usinglazy_gettext
.language_select.jinja
andlanguage_js.jinja
: template includes to add the language selection droplist anywhere in the UI. Currently on the main landing page and in Settings.Misc:
config.py
: Explicitly forcingFLASK_ENV=development
when using the DevelopmentConfigwallets.py
: Two routes were checking for POST when the route decorator could just be updated to limit to that method.jsonify
used in place of manually constructed json responses to be more pythonic.This is still very much a draft as I'm rushing to get this PR out for everyone to take a look (i.e. not my ideal level of self-scrutiny). There are bound to be some sloppy text wrapping mistakes that still need to be caught.