Creating a new localization (Mercurial)

  • Revision slug: Creating_a_new_localization_(Mercurial)
  • Revision title: Creating a new localization (Mercurial)
  • Revision id: 128740
  • Created:
  • Creator: Jürgen Jeka
  • Is current revision? No
  • Comment 2 words added, 2 words removed

Revision Content

{{ gecko_minversion_header("1.9.1") }}

This article covers how to create a new localization of Firefox from a Mercurial repository; this means it applies to version 3.5 of Firefox and later.  Similar instructions will also apply to non-Firefox projects based on Gecko 1.9.1, such as Thunderbird 3.

This article assumes you already have MozillaBuild 1.3 installed (on Windows), Mercurial, and Python setuptools installed.

Install the compare-locales utility

The first step is to install compare-locales.

wget http://pypi.python.org/packages/2.5/c/compare-locales/compare_locales-0.6.1-py2.5.egg#md5=0b939a22d87427d80f5286dc5eb1eab2
easy_install compare_locales-0.6.1-py2.5.egg

This will download and install the utility.

Clone the source code

The next step is to download a copy of the source code to your local system, using Mercurial.  For example, to fetch the code for Firefox 3.5, Thunderbird 3, and other Mozilla projects based on Gecko 1.9.1, use this command:

hg clone http://hg.mozilla.org/releases/mozilla-1.9.1

Create a bare-bones localization

Next, create a base localization.  This is done by cloning the en-US (United States English) files into your localization; specify your locale's language identifier in ab-CD format, where "ab" is the ISO 639 language code, and CD is the ISO 3166 country code.  The "-CD" part is only necessary to differentiate between versions of a language that are subtly different from country to country, such as in "en-US" and "en-GB" for United States English and British English.

Warning: Don't just copy and paste these commands; you need to replace "ab-CD" with your language identifier first!
mkdir -p ab-CD/browser/installer ab-CD/browser/profile/chrome ab-CD/browser/searchplugins ab-CD/browser/updater ab-CD/toolkit
cp mozilla-1.9.1/browser/locales/en-US/defines.inc ab-CD/browser
cp mozilla-1.9.1/browser/locales/en-US/profile/chrome/userC* ab-CD/browser/profile/chrome
cp mozilla-1.9.1/browser/locales/en-US/firefox-l10n.js ab-CD/browser
cp mozilla-1.9.1/browser/locales/en-US/README.txt ab-CD/browser
cp mozilla-1.9.1/browser/locales/en-US/searchplugins/list.txt ab-CD/browser/searchplugins
cp mozilla-1.9.1/browser/locales/en-US/updater/updater.ini ab-CD/browser/updater/updater.ini
cp mozilla-1.9.1/toolkit/locales/en-US/defines.inc ab-CD/toolkit

Set up for building

The next step is to create a .mozconfig file with the compile options for the localized build of Firefox, and to set up the object directory for the localized build.

cd mozilla-1.9.1
echo "mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../fx-ab-DC" > .mozconfig
echo "ac_add_options –with-l10n-base=../" >> .mozconfig
echo "ac_add_options –disable-compile-environment" >> .mozconfig
echo "ac_add_options –enable-application=browser" >> .mozconfig
make -f client.mk configure

Test merging

Now you can test merging your localization and language pack:

cd ../fx-ab-CD
make -C browser/locales merge-ab-CD LOCALE_MERGEDIR=`pwd`/../merge
make -C browser/locales langpack-ab-CD LOCALE_MERGEDIR=`pwd`/../merge LANGPACK_FILE=`pwd`/../firefox-ab-CD.xpi

What's next?

You're now ready to start work on localizing the Mozilla project.  See the article Maintaining a localization (Mercurial) for more information on what to do next.

See also

Revision Source

<p>{{ gecko_minversion_header("1.9.1") }}</p>
<p>This article covers how to create a new localization of Firefox from a Mercurial repository; this means it applies to version 3.5 of Firefox and later.  Similar instructions will also apply to non-Firefox projects based on Gecko 1.9.1, such as Thunderbird 3.</p>
<p>This article assumes you already have MozillaBuild 1.3 installed (on Windows), <a class="internal" href="/en/Mercurial" title="En/Mercurial">Mercurial</a>, and Python setuptools installed.</p>
<h2>Install the compare-locales utility</h2>
<p>The first step is to install <code>compare-locales</code>.</p>
<pre>wget http://pypi.python.org/packages/2.5/c/compare-locales/compare_locales-0.6.1-py2.5.egg#md5=0b939a22d87427d80f5286dc5eb1eab2
easy_install compare_locales-0.6.1-py2.5.egg
</pre>
<p>This will download and install the utility.</p>
<h2>Clone the source code</h2>
<p>The next step is to <a class="internal" href="/en/Mozilla_Source_Code_(Mercurial)" title="en/Mozilla Source Code (Mercurial)">download a copy of the source code</a> to your local system, using Mercurial.  For example, to fetch the code for Firefox 3.5, Thunderbird 3, and other Mozilla projects based on Gecko 1.9.1, use this command:</p>
<pre>hg clone http://hg.mozilla.org/releases/mozilla-1.9.1
</pre>
<h2>Create a bare-bones localization</h2>
<p>Next, create a base localization.  This is done by cloning the en-US (United States English) files into your localization; specify your locale's language identifier in ab-CD format, where "ab" is the <a class="external" href="http://www.w3.org/WAI/ER/IG/ert/iso639.htm" title="http://www.w3.org/WAI/ER/IG/ert/iso639.htm">ISO 639 language code</a>, and CD is the <a class="external" href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm" title="http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm">ISO 3166 country code</a>.  The "-CD" part is only necessary to differentiate between versions of a language that are subtly different from country to country, such as in "en-US" and "en-GB" for United States English and British English.</p>
<div class="warning"><strong>Warning:</strong> Don't just copy and paste these commands; you need to replace "ab-CD" with your language identifier first!</div>
<pre>mkdir -p ab-CD/browser/installer ab-CD/browser/profile/chrome ab-CD/browser/searchplugins ab-CD/browser/updater ab-CD/toolkit
cp mozilla-1.9.1/browser/locales/en-US/defines.inc ab-CD/browser
cp mozilla-1.9.1/browser/locales/en-US/profile/chrome/userC* ab-CD/browser/profile/chrome
cp mozilla-1.9.1/browser/locales/en-US/firefox-l10n.js ab-CD/browser
cp mozilla-1.9.1/browser/locales/en-US/README.txt ab-CD/browser
cp mozilla-1.9.1/browser/locales/en-US/searchplugins/list.txt ab-CD/browser/searchplugins
cp mozilla-1.9.1/browser/locales/en-US/updater/updater.ini ab-CD/browser/updater/updater.ini
cp mozilla-1.9.1/toolkit/locales/en-US/defines.inc ab-CD/toolkit
</pre>
<h2>Set up for building</h2>
<p>The next step is to create a <code>.mozconfig</code> file with the compile options for the localized build of Firefox, and to set up the object directory for the localized build.</p>
<pre>cd mozilla-1.9.1
echo "mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../fx-ab-DC" &gt; .mozconfig
echo "ac_add_options –with-l10n-base=../" &gt;&gt; .mozconfig
echo "ac_add_options –disable-compile-environment" &gt;&gt; .mozconfig
echo "ac_add_options –enable-application=browser" &gt;&gt; .mozconfig
make -f client.mk configure
</pre>
<h2>Test merging</h2>
<p>Now you can test merging your localization and language pack:</p>
<pre>cd ../fx-ab-CD
make -C browser/locales merge-ab-CD LOCALE_MERGEDIR=`pwd`/../merge
make -C browser/locales langpack-ab-CD LOCALE_MERGEDIR=`pwd`/../merge LANGPACK_FILE=`pwd`/../firefox-ab-CD.xpi
</pre>
<h2>What's next?</h2>
<p>You're now ready to start work on localizing the Mozilla project.  See the article <a class="internal" href="/En/Maintaining_a_localization_(Mercurial)" title="en/Maintaining a localization (Mercurial)">Maintaining a localization (Mercurial)</a> for more information on what to do next.</p>
<h2>See also</h2>
<ul> <li><a class="internal" href="/en/Create_a_new_localization" title="En/Create a new localization">Create a new localization</a> (covers Firefox 3 and earlier)</li> <li><a class="external" href="http://blog.mozilla.com/bhearsum/archives/78" title="http://blog.mozilla.com/bhearsum/archives/78">Creating a new localization for Firefox 3.1</a> (blog post by Ben Hearsum, on which this article is based)</li> <li><a class="internal" href="/en/Mozilla_Source_Code_(Mercurial)" title="En/Mozilla Source Code (Mercurial)">Mozilla Source Code (Mercurial)</a></li>
</ul>
Revert to this revision