Mobile/Fennec/Android/Multilocale Builds

From MozillaWiki
< Mobile‎ | Fennec‎ | Android
Revision as of 03:34, 17 November 2016 by Ahunt (talk | contribs) (Add further branches)
Jump to navigation Jump to search

Firefox for Android provides a locale switching system (which allows you to override the system locale). We ship with a large number of locales, however local builds default to only including en-US. Here's a guide for building an apk with multiple locales locally. (Nightly and release builds are built with all locales included.)

A list of all the supported locales can be found at: http://hg.mozilla.org/l10n-central

Multilocale builds require a full (non-artifact) build - they aren't recommended for everyday frontend development

Build recipe

  • Grab a copy of mozilla-central (or use an existing checkout)
  • Decide on the locales you desire, e.g. "ar zh-CN zh-TW pl de" (en-US will be included automatically).
  • Download localisation repos: you can use the following script to do so:
 MOZILLA_CENTRAL=~/moz/hg/mozilla-central # edit to reflect current clone
 L10NBASEDIR=~/moz/hg/l10n # edit to reflect where your l10n checkouts will go
 LANGS='ar zh-CN zh-TW pl de' # edit this to reflect your locale list
 
 mkdir -p $L10NBASEDIR
 pushd $L10NBASEDIR
 for loc in $LANGS; do if ! [ -d "$loc" ]; then hg clone "http://hg.mozilla.org/releases/l10n/mozilla-aurora/$loc"; fi; done
  • set up your mozconfig to include the following -Note: only full (non-artifact builds are supported):
 mk_add_options 'export MOZ_CHROME_MULTILOCALE=en-US ar zh-CN zh-TW de pl' # start with en-US, and add your desired locales from (2)
 # Use absolute paths.
 mk_add_options 'export L10NBASEDIR=/Users/andrzejhunt/moz/hg/l10n' # should match L10NBASEDIR from earlier
 ac_add_options --with-l10n-base=/Users/andrzejhunt/moz/hg/l10n
  • build using |mach build|
  • build and merge the localisations:
    • edit the list below to include all your desired locales (do NOT include en-US, that was already built during |mach build|), and replace the mozilla-central path with your own checkout path
 for loc in ar pl de zh-TW; do  make -C objdir-frontend/mobile/android/locales merge-$loc LOCALE_MERGEDIR=/Users/andrzejhunt/ff/fx3/objdir-frontend/merge-$loc; make -C objdir-frontend/mobile/android/locales chrome-$loc LOCALE_MERGEDIR=/Users/andrzejhunt/moz/hg/mozilla-central/objdir-frontend/merge-$loc; done
  • |mach package| && |mach install| to test

Additional notes

  • The l10n-central locales can be out of date (i.e. will be missing some strings). The merge-$loc step merges locales with en-US, i.e. en-US strings will be used as a fallback for missing strings.
    • Locales that are complete therefore don't require the merge-$loc step, however as of writing only 6 locales were actually complete on mozilla-central/l10n-central (missing strings will result in |mach package| failing due to xml errors / missing entities).
    • chrome-$loc is still needed for every locale.
    • Beta/release builds usually won't need merge-$loc.
  • Separate repos exist for aurora/beta/release. You probably won't need these unless testing multilocale on those branches.

The original multilocale guide can be found on Richard Newman's blog at http://160.twinql.com/building-and-testing-multi-locale-firefox-for-android/ . That blog also contains a plethora of other postings discussing multilocale support.