-
Notifications
You must be signed in to change notification settings - Fork 711
Localization
Firefox Focus for Android is getting localized on Pontoon.
For converting between Android XML files and Gettext PO files (to be consumed by Pontoon) we use a local, slightly modified version of android2po (See tools/l10n/android2po
).
New strings are flagged with the strings-approved label, and should be slated for the current milestone. These strings should be added to app/src/main/res/values/strings.xml - include localization notes if necessary for clarity. Remove the strings-approved
label once the strings have been added.
If you're replacing or deleting a string, you also need to export and then import strings again. (For now, the import script resets the state of the l10n repo so you need to comment out the lines of import-strings.sh
that hard-reset the l10n repo.)
-
Python, Pip and Git need to be installed.
You can optionally set up a virtualenv for running all these scripts in:
virtualenv <new_env> source <new_env>/bin/activate
Remember to exit the virtualenv when you've finished with everything.
deactivate
-
Install the dependencies.
pip install -r tools/l10n/android2po/requirements.txt
-
You should have a fork of the focus-android-l10n repo in order to make a PR.
-
Export the string changes into a branch against the focus-android-l10n repo.
sh tools/l10n/export-strings.sh
This will clone the l10n Focus repo into the Focus directory if it doesn't already exist, update to the most recent commit, and create a new branch with the string changes per locale in separate commits. The l10n strings repo will be located at
$topsrcdir/l10n-repo
, and the new branch will be of the formatexport-YYYY-MM-DD
. -
Verify that the changes made to
locales/templates/app.pot
are the strings added.Note: Do not be alarmed if there are whitespace changes unrelated to your string changes in the individual language locale files - these are a result of different serializers being used when reading/writing the localization files. There may also be changes in the header items, that are related to the metadata changes made by the POEdit editor.
-
Add your fork as a remote if it doesn't already exist.
git remote add <username> [email protected]:<username>/focus-android-l10n.git
-
Push the branch to your forked repo and make a PR against the mozilla-l10n/focus-android-l10n repo.
git push <username> <export-branch>
Since many contributors modify the l10n files, you need to make sure to coordinate with the l10n team because a PR can go stale very quickly and result in conflicts.
-
Run the import script with
sh tools/l10n/import-strings.sh
. This will update the l10n repo (or clone it if it doesn't exist) and import the strings.Troubleshooting:
[values-<locale>/strings.xml] missing placeholder in translation, key: <key_name>
- This is an error. A placeholder (%1$s) was omitted in the translation. Remove the problematic line/string from the file (it will default to the non-localized string).
[values-<locale>/strings.xml] number of placeholders not matching, key: <key_name>
- This is just a warning, and no action needs to be taken.
-
Verify the changes and then commit and push the updated XML files to the app repository.
tools/l10n/locales.py
is the master list for the locales that will be included in the release. Usually, the locales that need to be added are already included in ADDITIONAL_SCREENSHOT_LOCALES
, so they just need to be moved to RELEASE_LOCALES
.