L10n:B2G/Localizers: Difference between revisions
m (→How this works) |
|||
Line 73: | Line 73: | ||
@import url(browser.pl.properties) | @import url(browser.pl.properties) | ||
We | We might get rid of the *.ini files completely ({{bug|809600}}). In the meantime, you can using my helper script, [https://raw.github.com/stasm/gaia-l10n/master/migrate.sh migrate.sh]: | ||
cd gaia/locales | |||
./migrate.sh ini pl | |||
===Run Gaia=== | ===Run Gaia=== |
Revision as of 17:15, 13 November 2012
For now, this is just a collection of blog posts.
Localizing
Testing
It's possible to test localizations using a desktop build of B2G. The trickiest part is adding your locale to the build, but you only have to do it once. All the work that follows happens in your locale's HG repository.
Download B2G Desktop
First, you'll need a desktop build of B2G.
- If you're on Mac or Windows, download one from http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/
- If you're on Linux, download one from http://people.mozilla.com/~stas/b2g/. This build has a patch from bug 799768 which makes B2G run much more smoothly.
Install or unzip the package.
Set up Gaia
Clone Gaia and create a new debugging profile.
git clone git://github.com/mozilla-b2g/gaia.git cd gaia DEBUG=1 make profile
Setup the l10n repo
In your `gaia` clone from the step above:
cd locales hg clone https://hg.mozilla.org/gaia-l10n/en-US/ hg clone ssh://hg.mozilla.org/gaia-l10n/pl/
(Replace pl
with your locale.)
Enable your locale
apps/settings/index.html
Add your locale to the section of
apps/settings/index.html
. Notice the value=
part.
<li> <span data-l10n-id="language">Language <select name="language.current"> <option value="ar">العربية</option> <option value="en-US">English (US)</option> <option value="fr">Français</option> <option value="pl">Polski</option> <option value="zh-TW">正體中文</option> </select> </span>
apps/settings/resources/languages.json
Next, add you locale to apps/settings/resources/languages.json
:
{ "ar" : "العربية", "en-US" : "English (US)", "fr" : "Français", "pl" : "Polski", "zh-TW" : "正體中文" }
locales.ini
For every app you're testing, edit its locales/locales.ini
file and add your locale:
[pl] @import url(browser.pl.properties)
We might get rid of the *.ini files completely (bug 809600). In the meantime, you can using my helper script, migrate.sh:
cd gaia/locales ./migrate.sh ini pl
Run Gaia
/path/to/b2g -profile /path/to/gaia/profile
(On Mac OS X, the path to the b2g executable is /Applications/B2G.app/Contents/MacOS/b2g
. You'll also need to specify absolute path to the profile, without the trailing slash.)
Skip the First Time Screen by pressing "Next" a few times (it will be localized too, eventually).
Go into Settings and change the locale of the device.
Use 'Home' on your keyboard to close Settings
How this works
Thanks to DEBUG=1
, Gaia will look for files in /locales/pl/
. See https://hg.mozilla.org/gaia-l10n/en-US/ for how to lay out the files. File names should be browser.properties
, and not browser.en-US.properties
even though /apps/browser/locales/locales.ini
might suggest otherwise. There's some magic going on with the file names and locations to make it easier to just clone the Mercurial repo into /locales
.
Troubleshooting/Known Issues
- You may need to restart your desktop build the first time you change the locale to yours.
- When an app appears to not work with your locale:
- Make sure its locale/locales.ini lists your locale
- Close the desktop build and wait a minute. I'm serious. I think there's some caching issue with the debug server running on port 8080.
- The "Language" panel in the Settings app might read "undefined" instead of showing your locale's name.
- The names of the applications will be in English.
- To localize dates (like the one on the lockscreen) localize
shared/date/date.properties
Related
- Running Boot to Gecko on your desktop (you might want to run r2d2b2g instead)
- How to test localizability of Gaia system apps