L10n:B2G/Localizers: Difference between revisions

add variable to specify the keyboard layouts to include in the profile
(→‎Run Gaia: add how to close settings)
(add variable to specify the keyboard layouts to include in the profile)
 
(21 intermediate revisions by 4 users not shown)
Line 2: Line 2:


==Localizing==
==Localizing==
* [http://www.informationisart.com/14/ September 21 - First string freeze for Gaia]
* [http://www.informationisart.com/16/ Bucket 1 Gaia apps are now string-frozen]


==Testing==
Clone the en-US repo:


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.
    hg clone https://hg.mozilla.org/gaia-l10n/en-US


===Download B2G Desktop===
and your locale's repo (I use <code>pl</code> as an example):
 
    hg clone ssh://hg.mozilla.org/gaia-l10n/pl
 
Install [http://pypi.python.org/pypi/compare-locales 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'
 
* https://l10n.mozilla.org/teams/pl (replace 'pl' with your locale)
* https://l10n.mozilla.org/shipping/dashboard?tree=gaia (for es and pt-BR)
* https://l10n.mozilla.org/shipping/dashboard?tree=gaia-community (for all other locales)
 
==Testing using the Firefox OS Simulator addon==
 
Install in your Firefox:
 
;Windows: https://ftp.mozilla.org/pub/mozilla.org/labs/r2d2b2g/r2d2b2g-l10n-windows.xpi
;Mac: https://ftp.mozilla.org/pub/mozilla.org/labs/r2d2b2g/r2d2b2g-l10n-mac.xpi
;Linux: https://ftp.mozilla.org/pub/mozilla.org/labs/r2d2b2g/r2d2b2g-l10n-linux.xpi
 
==Testing using standalone nightly builds==
 
These are the same bits as the Firefox OS Simulator, but are standalone and built every night.
 
Go to http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-b2g18/ to download a nightly desktop build. You should get one of the <code>b2g-18.0.multi.*-localizer.*</code> builds.  Their built-in profile have the newest localization files.
 
* [http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-b2g18/b2g-18.0.multi.linux-i686-localizer.tar.bz2 b2g-18.0.multi.linux-i686-localizer.tar.bz2] (Linux 32-bit)
* [http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-b2g18/b2g-18.0.multi.linux-x86_64-localizer.tar.bz2 b2g-18.0.multi.linux-x86_64-localizer.tar.bz2 (Linux 64-bit)]
* [http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-b2g18/b2g-18.0.multi.mac64-localizer.dmg b2g-18.0.multi.mac64-localizer.dmg] (Mac OS X 64-bit)
* [http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-b2g18/b2g-18.0.multi.win32-localizer.zip b2g-18.0.multi.win32-localizer.zip] (Windows 32-bit)
 
Here's what each part of the filename means:
 
* <code>b2g-18.0</code> is the Gecko branch; we now moved away from central/aurora/beta and created a separate branch of Gecko just for B2G,
* <code>multi</code> denotes a multilocale Gecko build; <code>netError.dtd</code> and <code>appstring.properties</code> will be localized; you can test this by opening the browser app in Gaia and trying to access a nonexisting page; the "Server not found" error page should be localized,
* next up is the platform, pretty self-explanatory,
* <code>localizer</code> denotes a multilocale Gaia build, i.e. a build which has all locales enabled in it; see <code>[https://github.com/mozilla-b2g/gaia/blob/master/locales/languages_all.json languages-all.json]</code> for the list.
 
==Testing using own Gaia profile==
 
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.


First, you'll need a desktop build of B2G.
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/.


* If you're on Mac or Windows, download one from http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/
===Download B2G Desktop===
* 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.
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===
===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
 
Check out the <code>v1-train</code> branch:
 
     git checkout -b v1-train origin/v1-train


===Setup the l10n repo===
===Setup the l10n repo===
Line 31: Line 73:


     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 38: Line 79:
===Enable your locale===
===Enable your locale===


====apps/settings/index.html====
====locales/languages_all.json====
 
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>:
Next, add you locale to <code>[https://github.com/mozilla-b2g/gaia/blob/master/locales/languages_all.json locales/languages_all.json]</code>:


     {
     {
Line 66: Line 91:
     }
     }


====locales.ini====
===Create a profile===
 
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:


    [pl]
Now create a profile with your locale enabled:
    @import url(browser.pl.properties)


We will either automate this step or get rid of the *.ini files completely ({{bug|809600}}.  Thanks for your understanding.
    make profile LOCALE_BASEDIR=locales/ LOCALES_FILE=locales/languages_all.json GAIA_DEFAULT_LOCALE=pl GAIA_KEYBOARD_LAYOUTS=en,pl


===Run Gaia===
===Run Gaia===


     /path/to/b2g -profile /path/to/gaia/profile
     /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`.  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>.
(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.)


===Troubleshooting/Known Issues===
===Troubleshooting/Known Issues===
Confirmed users
12

edits