L10n:B2G/Localizers: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 33: Line 33:
===Set up Gaia===
===Set up Gaia===


Clone Gaia and create a '''new debugging profile'''.
Clone Gaia.


     git clone git://github.com/mozilla-b2g/gaia.git
     git clone git://github.com/mozilla-b2g/gaia.git
     cd gaia
     cd gaia
    DEBUG=1 make profile


===Setup the l10n repo===
===Setup the l10n repo===
Line 44: Line 43:


     cd locales
     cd locales
    hg clone https://hg.mozilla.org/gaia-l10n/en-US/
     hg clone ssh://hg.mozilla.org/gaia-l10n/pl/
     hg clone ssh://hg.mozilla.org/gaia-l10n/pl/


Line 51: Line 49:
===Enable your locale===
===Enable your locale===


====apps/settings/resources/languages.json====
====shared/resources/languages.json====


Next, add you locale to <code>[https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/resources/languages.json apps/settings/resources/languages.json]</code>:
Next, add you locale to <code>[https://github.com/mozilla-b2g/gaia/blob/master/shared/resources/languages.json shared/resources/languages.json]</code>:


     {
     {
Line 63: Line 61:
     }
     }


====locales.ini====
====Localization files====


For '''every''' app you're testing, edit its <code>[https://github.com/mozilla-b2g/gaia/blob/master/apps/browser/locales/locales.ini locales/locales.ini]</code> file and add your locale:
You'll need to have Python installed for this next step. OS X and most Linux distributions come with it by default. You can download the Windows installer at http://www.python.org/download/.


    [pl]
Run <code>python build/multilocale.py --config shared/resources/languages.json --target apps --target shared --source locales/ pl</code> (replace "pl" with your locale) to copy the localization files to apps' folders and enable your locale in the appropriate locales.ini files.
    @import url(browser.pl.properties)


You may need to do the same in <code>shared/locales</code> for picking up date formats and the like.
===Create a profile===


If you have python on your system, you can run <code>python build/multilocale.py --ini --target apps --target shared pl</code> (replace "pl" with your locale) to automate this step.
Now create a profile with your locale enabled:
 
    make profile (or ./build.sh gaia if you're building the entire B2G project)


===Run Gaia===
===Run Gaia===
Line 79: Line 78:


(On Mac OS X, the path to the b2g executable is <code>/Applications/B2G.app/Contents/MacOS/b2g-bin</code>.  You'll also need to specify ''absolute'' path to the profile, without the trailing slash.)
(On Mac OS X, the path to the b2g executable is <code>/Applications/B2G.app/Contents/MacOS/b2g-bin</code>.  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 <code>DEBUG=1</code>, Gaia will look for files in <code>/locales/pl/</code>.  See https://hg.mozilla.org/gaia-l10n/en-US/ for how to lay out the files.  File names should be <code>browser.properties</code>, and ''not'' <code>browser.en-US.properties</code> even though <code>/apps/browser/locales/locales.ini</code> 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 <code>/locales</code>.


===Troubleshooting/Known Issues===
===Troubleshooting/Known Issues===

Revision as of 01:47, 9 January 2013

For now, this is just a collection of blog posts.

Localizing

Clone the en-US repo:

   hg clone https://hg.mozilla.org/gaia-l10n/en-US

and your locale's repo (I use pl as an example):

   hg clone ssh://hg.mozilla.org/gaia-l10n/pl

Install compare-locales and use compare-dirs to diff your locale against en-US:

   compare-dirs en-US pl

Alternatively, you can go to Elmo and look for the stats for 'gaia' or 'gaia-community'

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. Download one from http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-b2g18/ and install or unzip the package.

Set up Gaia

Clone Gaia.

   git clone git://github.com/mozilla-b2g/gaia.git
   cd gaia

Setup the l10n repo

In your `gaia` clone from the step above:

   cd locales
   hg clone ssh://hg.mozilla.org/gaia-l10n/pl/

(Replace pl with your locale.)

Enable your locale

shared/resources/languages.json

Next, add you locale to shared/resources/languages.json:

   {
     "ar" : "العربية",
     "en-US" : "English (US)",
     "fr" : "Français",
     "pl" : "Polski",
     "zh-TW" : "正體中文"
   }

Localization files

You'll need to have Python installed for this next step. OS X and most Linux distributions come with it by default. You can download the Windows installer at http://www.python.org/download/.

Run python build/multilocale.py --config shared/resources/languages.json --target apps --target shared --source locales/ pl (replace "pl" with your locale) to copy the localization files to apps' folders and enable your locale in the appropriate locales.ini files.

Create a profile

Now create a profile with your locale enabled:

   make profile (or ./build.sh gaia if you're building the entire B2G project)

Run Gaia

   /path/to/b2g-bin -profile /path/to/gaia/profile

(On Mac OS X, the path to the b2g executable is /Applications/B2G.app/Contents/MacOS/b2g-bin. You'll also need to specify absolute path to the profile, without the trailing slash.)

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:
    1. Make sure its locale/locales.ini lists your locale
    2. 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