Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Localization

liuche edited this page Sep 30, 2017 · 17 revisions

Firefox Focus for Android is getting localized on Pontoon.

Updating translations

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).

Adding strings for translation

New strings are flagged with the strings-approved label. 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.

Localization Scripts Setup

  1. 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
  2. Install the dependencies.

    pip install -r tools/l10n/android2po/requirements.txt

Export strings for translation

  1. You should have a fork of the focus-android-l10n repo in order to make a PR.

  2. 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 format export-YYYY-MM-DD.

  3. Add your fork as a remote if it doesn't already exist.

    git remote add <username> [email protected]:<username>/focus-android-l10n.git

  4. Push the branch to your forked repo and make a PR against the mozilla-l10n/focus-android-l10n repo.

    git push <username> <export-branch>

Import translated strings

  1. Fetch the latest changes from the L10N repository and remove all local modifications with the stringsCleanUpdate gradle task:

    ./gradlew stringsCleanUpdate
  2. Run the stringsImport gradle task to generate the Android XML files.

    ./gradlew stringsImport
  3. Verify the changes and then commit and push the updated XML files to the app repository.

Clone this wiki locally