L10n:B2G/Localizers: Difference between revisions

(Created page with "For now, this is just a collection of blog posts. ==Localizing== * [http://www.informationisart.com/14/ September 21 - First string freeze for Gaia] * [http://www.informationisa...")
 
Line 6: Line 6:


==Testing==
==Testing==
* [https://gist.github.com/3793871 Quick & dirty instructions]
 
It's possible to test localizations using a desktop build of B2G.  The trickiest part is adding your locale to the build, but yo only have to do it once.  All the work that follows happens in your locales 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 <code>pl</code> with your locale.)
 
===Enable your locale===
 
====apps/settings/index.html====
 
Add your locale to the <code><!-- Personalization :: Language & Region --></code> section of <code>[https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/index.html#L964 apps/settings/index.html]</code>.  Notice the <code>value=</code> part.
 
    &lt;li>
      &lt;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>
      &lt;/span>
    </li>
 
====apps/settings/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>:
 
    {
      "ar" : "العربية",
      "en-US" : "English (US)",
      "fr" : "Français",
      '''"pl" : "Polski",'''
      "zh-TW" : "正體中文"
    }
 
====locales.ini====
 
For '''every''' app you're testing, edit its <code>[https://github.com/mozilla-b2g/gaia/blob/master/apps/browser/locales/locales.ini locale/locales.ini]</code> file and add your locale:
 
    [pl]
    @import url(browser.pl.properties)
 
===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.)
 
Go into Settings and change the locale of the device.
 
===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>.
 
==Related==
* [https://gist.github.com/3793871 Quick & dirty testing instructions]
* [http://www.informationisart.com/11/ Running Boot to Gecko on your desktop] (you might want to run [http://people.mozilla.com/~myk/r2d2b2g/ r2d2b2g] instead)
* [http://www.informationisart.com/11/ Running Boot to Gecko on your desktop] (you might want to run [http://people.mozilla.com/~myk/r2d2b2g/ r2d2b2g] instead)
* [http://www.informationisart.com/13/ How to test localizability of Gaia system apps]
* [http://www.informationisart.com/13/ How to test localizability of Gaia system apps]
canmove, Confirmed users
1,448

edits