Skip to content

Instantly share code, notes, and snippets.

@SunboX
Last active August 29, 2015 14:06
Show Gist options
  • Save SunboX/2e0623628b89c4679f8b to your computer and use it in GitHub Desktop.
Save SunboX/2e0623628b89c4679f8b to your computer and use it in GitHub Desktop.
Build and install localized (L10N) Gaia

How to flash your locale to your Device

prerequisites

Note: Under 64 bit Ubuntu I have to install these packages:

apt-get install make git mercurial python lib32ncurses5 lib32stdc++6 android-tools-adb

The following instructions are for 1.2 and newer versions. For example, for 1.3 the localization files are in http://hg.mozilla.org/releases/gaia-l10n/v1_3/ (use ssh:// instead of http:// if you have access).

See https://groups.google.com/forum/#!topic/mozilla.dev.l10n/zwpP8Wa_KvA for more information.

If you already have your system set-up for previous versions, you can remove the „locales“ folder, clone the correct l10n repository for v1.x and checkout v1.x from github. If you have any doubts, ask on dev-l10n or #l10n on irc.mozilla.org

Setup Gaia (do this once)

Example for 1.3

mkdir ~/moz
cd ~/moz
git clone https://github.com/mozilla-b2g/gaia
cd gaia
git checkout v1.3
cd locales

Add the localization files for 1.3

This only works if you have ssh access. If you don't, use http:// instead. Replace „de“ with your locale code (e.g. fr, pl, etc.)

hg clone ssh://hg.mozilla.org/releases/gaia-l10n/v1_3/de
cd ..

At this point you're ready to flash Gaia to the phone for the first time. Connect the phone and make sure Remote Debugging is checked in Settings > Device Information > More Information > Developer. You only need to do this once, for your own build of Gaia will have that pref turned on thanks to DEVICE_DEBUG=1 (if it doesn't work, use REMOTE_DEBUGGER=1 for older versions of Gaia).

The following is a single command. Replace „de“ with your locale code

make clean && PRODUCTION=1 make install-gaia MAKECMDGOALS=production MOZILLA_OFFICIAL=1 GAIA_DEFAULT_LOCALE=de LOCALES_FILE=locales/languages_all.json LOCALE_BASEDIR=locales/ DEVICE_DEBUG=1

Since bug 884752 landed (November 2013), to add keyboard layouts (if available in Gaia), you can use parameter GAIA_KEYBOARD_LAYOUTS.

For example, to add German and French keyboard layout, run the make command adding

GAIA_KEYBOARD_LAYOUTS=de,fr

Updating Gaia & the l10n files

cd ~/moz/gaia/
git checkout v1.3
git pull
# Replace „de“ with your locale code
cd locales/de
hg pull -u
cd ../..

The following is a single command. Replace „de“ with your locale code

make clean && PRODUCTION=1 make install-gaia MAKECMDGOALS=production MOZILLA_OFFICIAL=1 GAIA_DEFAULT_LOCALE=de LOCALES_FILE=locales/languages_all.json LOCALE_BASEDIR=locales/ DEVICE_DEBUG=1

See notes above about adding keyboard layouts.

Note: if „git pull" doesn't work because of conflicts in your local copy, you can run „git reset --hard" before „git pull". You could also create a simple bash script similar to this one to avoid typing the commands (you can reuse this script, just change the value of localecode and repofolder at the beginning of the file):

https://github.com/flodolo/scripts/tree/master/gaia

More information: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Building#Building_multilocale

udev trick (Linux)

To be able to flash your phone without `sudo', add this in an /etc/udev/rules.d/51-android.rules file:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
# ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev"
#keon:
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev"

and restart udev:

sudo service udev restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment