Adding a new locale to the single-locale build

Android has two different types of builds: a multi-locale build that ships in Google Play Store, and a single-locale build (containing only one locale) that is mostly used for testing.

The list of locales for which single-locale builds are created is stored inside a file named all-locales within Mozilla’s code repositories. Since the goal is to create Nightly builds, the file will be in mozilla-central: https://hg.mozilla.org/mozilla-central/file/default/browser/locales/all-locales

File a bug to add the new locale

You need to file a bug in Firefox for Android::General requesting the new locale (see for example this bug for Guaraní). You can use this bug template to make things faster (update with the appropriate locale code and language name).

You also want to file a bug to use as tracker (example for gn), adding an alias like fm-l10n-gn for gn and blocking fm-l10n-tracker.

Land initial content in l10n repository

With cross-channel, all builds of Firefox and Firefox Android are generated using strings from the l10n-central repository. If a project started localizing using a BitBucket repository, it’s fundamental to populate l10n-central with that content when requesting the official repository creation on https://hg.mozilla.org/l10n-central/LOCALE_CODE.

After the first content lands in l10n-central, it’s a good idea to perform some basic checks before enabling the build:

  • Check toolkit/global/intl.properties (en-US version) for evident mistakes.
  • Check if there’s a region.properties file in mobile/chrome/region.properties. If needed replace it with the stock version.

Set up searchplugins

Check the Set up searchplugins document for detailed instructions on how to set up searchplugins for new locales.

Creating a patch for build configuration

First of all make sure that your environment is correctly set up, and update your local mozilla-unified clone:

$ cd ~/mozilla/mercurial/mozilla-unified
$ hg pull -r default -u
$ hg update central

The file to modify is in mobile/android/locales/all-locales, open it with your text editor of choice.

$ atom mobile/android/locales/all-locales

And add the new locale to the list. With Atom and the Sort Lines package installed, you can press F5 to make sure that the list is in alphabetical order. Let’s say for example that you need to add ab-CD to the list of supported locales.

The second file to modify is mobile/android/locales/l10n.toml. This is the beginning of the file:

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

basepath = "../../.."

locales = [
    "an",
    "ar",
    "as",
    "ast",
    "az",
...

Identify the locales section, and add the new locale code between double quotes, followed by a comma. As before, you can use Atom to make sure the list is in alphabetical order (make sure to select only the lines with actual locale codes before pressing F5).

Once this is done, identify the exclude-multi-locale section. Since this locale is not shipping on multi-locale builds yet, you should add it there too.

After you’ve finished editing the files, check the status of the repository, and the diff.

$ hg status
M mobile/android/locales/all-locales

$ hg diff
--- a/mobile/android/locales/all-locales
+++ b/mobile/android/locales/all-locales
@@ -1,8 +1,9 @@
+ab-CD
 ar
 be
 ca
 cs
 da
 de
 es-AR
 es-ES

 diff --git a/mobile/android/locales/l10n.toml b/mobile/android/locales/l10n.toml
 --- a/mobile/android/locales/l10n.toml
 +++ b/mobile/android/locales/l10n.toml
 @@ -9,8 +9,9 @@ locales = [
 +    "ab-CD",
      "ar",
      "be",
      "ca",
      "cs",
      "da",
      "es-AR",
@@ -9,8 +9,9 @@ exclude-multi-locale = [
  +    "ab-CD",
       "ia",
       "oc",
...

M in hg status indicates that the file has been modified, + in hg diff that the line has been added. Follow the instructions available in this document to create a patch, submit it for review, and land it.

After the patch has landed

A couple of days after the patch has landed check on FTP if builds are being generated for this new locale: https://ftp.mozilla.org/pub/mobile/nightly/latest-mozilla-central-android-api-16-l10n/

If there are no builds present, it’s usually due to errors in the locale, for example straight single or double quotes in Android DTDs. Check the team’s dashboard for these kind of errors.