Mobile/Fennec/Android/Multilocale Builds: Difference between revisions
Jump to navigation
Jump to search
(Created page with "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 t...") |
No edit summary |
||
Line 11: | Line 11: | ||
MOZILLA_CENTRAL=~/moz/hg/mozilla-central # edit to reflect current clone | MOZILLA_CENTRAL=~/moz/hg/mozilla-central # edit to reflect current clone | ||
L10NBASEDIR=~/moz/hg/l10n # edit to reflect where your l10n checkouts will go | 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 | |||
mkdir - | |||
pushd $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: | * set up your mozconfig to include the following: | ||
** Note: only full (non-artifact builds are supported) | ** '''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) | 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. | # Use absolute paths. | ||
mk_add_options 'export L10NBASEDIR=/Users/andrzejhunt/ | mk_add_options 'export L10NBASEDIR=/Users/andrzejhunt/moz/hg/l10n' # should match L10NBASEDIR from earlier | ||
ac_add_options --with-l10n-base=/Users/andrzejhunt/ | ac_add_options --with-l10n-base=/Users/andrzejhunt/moz/hg/l10n | ||
* build using |mach build| | * build using |mach build| | ||
* build and merge the localisations: | * 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|) | ** 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/ | 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 package| && |mach install| to test | * |mach package| && |mach install| to test | ||
Revision as of 02:53, 16 November 2016
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
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), for simplicity dump these into a file called "multicocale-langs".
- 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 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 (missing strings will result in |mach package| failing due to xml errors / missing entities).
- But chrome-$loc is still needed for every locale.
- But aurora/beta/release builds usually won't need merge-$loc
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.