Localizing without a specialized tool

  • Revision slug: Localizing_without_a_specialized_tool
  • Revision title: Localizing without a specialized tool
  • Revision id: 66003
  • Created:
  • Creator: sethb@mozilla.com
  • Is current revision? No
  • Comment 53 words removed

Revision Content

From the Create a New Localization document, an interested localizer can follow a technical step-by-step process that starts the localization process by focusing on how to localize two of the primary types of localization files (DTD and property) used in the Mozilla source code.  With that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation.  Repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version.

If you choose to localize Mozilla with nothing more than a text editing application and not a specialized tool, this document (along with Create a New Localization) will enable you to learn just what needs to be done.

Before we start, did you make sure to install Mercurial and confirm that you have set up the proper build environment on your local machine?  You cannot begin localizing Mozilla file by file without a specialized too without going through the Create a New Localization page.

Getting Started with Compare-Locales

You are going to need to create the structure of your localization, where, one-by-one, each of the files needing localization will be copied.  This directory structure needs to mimic the same as the en-US source files concerning localization.  To start, be sure to open your command line interface and change your directory to where you are keeping your localization files, the en-US sources

$ cd /path/to/your/working/directory  

Now, you will need run compare locales and save the output in a text file on your Desktop so you can review it as you go.  To do this, enter the following commands, keeping sure to change "path/to/mozilla-1.9.2", "path/to/l10n_base/", and "ab-CD", where l10n_base is where you store the locales you are working on and "ab-CD" is the actual locale code of your locale.

$ compare-locales path/to/mozilla-1.9.2/.../l10n.ini pathto/l10n_base/ ab-CD
$ compare-locales mozilla-1.9.2/browser/locales/l10n.ini l10n-mozilla-1.9.2 ab-CD > ~/Desktop/ab-CD.compare

Open the ab-CD.compare file that is on your desktop.  You should see something like this:

ab-CD
  browser
    chrome
      browser
        .DS_Store
            // add and localize this file
        aboutCertError.dtd
            // add and localize this file
        aboutDialog.dtd
            +aboutLink
            +aboutLink.accesskey
            +aboutVersion
            +closeCmdGNOME.accesskey
            +closeCmdGNOME.label
            +copyright
            +copyright.accesskey
            +copyrightGNOME.accesskey
            +copyrightInfo1
            +copyrightInfo2
            +licenseLink
            +licenseLinkText
        aboutPrivateBrowsing.dtd
            // add and localize this file
        aboutRobots.dtd
            // add and localize this file
        ...
        ...
        ...
ab-CD:
unchanged: 2
changed: 3
missingInFiles: 6117
missing: 13
0% of entries changed

The beauty of the compare-locales output is that it tells you all the missing files and which files you need to add and localize.  This will be your guide to localize Firefox.

Localizing Step-by-Step

With your compare-locales output open for review, we will start with the first file with "// add and localize this file" note.  You should see

 // add and localize this file
        aboutCertError.dtd

Notice from the compare-locales output that this file is located in the directory /browser/chrome/browser.  You will want to copy this file from the en-US sources into the proper ab-CD directory. To do this, you first need to create the directory structure and then copy the file into it.  Type the command

pwd

to make sure you are in

/path/to/your/working/directory

And then type the command

mkdir /browser/chrome/browser

Now, copy the file by typing

cp -R mozilla-1.9.2/browser/locales/en-US/chrome/browser/aboutCertError.dtd ab-CD/browser/chrome/browser/aboutCertError.dtd

You should now see the aboutCertError.dtd file in that newly created directory.  Your compare locales output follows the exact nested source structure.  Each time you see a directory or set of sub-directories, you will need to run the mkdir command inside your locale directory and then copy the .dtd or property files into that directory.

Translating

To start editing, you will need a text editing application. You can choose to use:

(Read more about tools at L10n:Tools.)

After you have downloaded your editor of choice, type the following command in the same path from above (~/ab-CD/browser/chrome/browser)

$ edit ab-CD/browser/chrome/browser/aboutCertError.dtd

Read the top of the file to get any context on how to translate contained in the notes written by the developers or l10n-drivers.  Localization notes will look like this:

<!-- LOCALIZATION NOTES... -->

After the localization notes, you will see a list of <!ENTITY> strings like the following:

<!ENTITY certerror.pagetitle  "Untrusted Connection">

You should go through each entity, translating  the value in the parameters (e.g. Untrusted Connection in the example above), like so (example for Polish):

<!ENTITY certerror.pagetitle  "Niezaufane połączenie">

Once you have translated all the <!ENTITY> strings in this file, you should save your work and open the next .dtd or .property file.  You will need to go through each and every file to in every directory in ab-CD.

Recommended order of localization

For recommended order of localization, refer to the localization "phase list" which provides a very rough guide on where to start and in what order to proceed through translation.

Land your translated files one by one, making sure it follows the *mozilla-1.9.2* structure.  This will familiarize you with our "Hg"
commands and will get us something that we can import easily when you are done.

Revision Source

<p>From the <a href="/User:stasm/Create_a_new_localization" title="https://developer.mozilla.org/User:stasm/Create_a_new_localization">Create a New Localization</a> document, an interested localizer can follow a technical step-by-step process that starts the localization process by focusing on how to localize two of the primary types of localization files (DTD and property) used in the Mozilla source code.  With that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to <a href="/User:stasm/Create_a_new_localization#Creating_a_langpack" title="https://developer.mozilla.org/User:stasm/Create_a_new_localization#Creating_a_langpack">create a language pack</a> or <a href="/User:stasm/Create_a_new_localization#Repacking_the_binary" title="https://developer.mozilla.org/User:stasm/Create_a_new_localization#Repacking_the_binary">a binary file</a> that is ready for installation.  Repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version.</p>
<p>If you choose to localize Mozilla with nothing more than a text editing application and not a specialized tool, this document (along with <a href="/User:stasm/Create_a_new_localization" title="https://developer.mozilla.org/User:stasm/Create_a_new_localization">Create a New Localization</a>) will enable you to learn just what needs to be done.</p>
<p>Before we start, did you make sure to <a href="/User:stasm/Create_a_new_localization#Install_Mercurial_on_Windows" title="https://developer.mozilla.org/User:stasm/Create_a_new_localization#Install_Mercurial_on_Windows">install Mercurial</a> and confirm that you have <a href="/User:stasm/Create_a_new_localization#System_environment_requirements" title="https://developer.mozilla.org/User:stasm/Create_a_new_localization#System_environment_requirements">set up the proper build environment</a> on your local machine?  You cannot begin localizing Mozilla file by file without a specialized too without going through the <a href="/User:stasm/Create_a_new_localization" title="https://developer.mozilla.org/User:stasm/Create_a_new_localization">Create a New Localization</a> page.</p>
<h2>Getting Started with Compare-Locales</h2>
<p>You are going to need to create the structure of your localization, where, one-by-one, each of the files needing localization will be copied.  This directory structure needs to mimic the same as the en-US source files concerning localization.  To start, be sure to open your command line interface and change your directory to where you are keeping your localization files, the en-US sources</p>
<pre>$ cd /path/to/your/working/directory  </pre>
<p>Now, you will need run compare locales and save the output in a text file on your Desktop so you can review it as you go.  To do this, enter the following commands, keeping sure to change "path/to/mozilla-1.9.2", "path/to/l10n_base/", and "ab-CD", where l10n_base is where you store the locales you are working on and "ab-CD" is the actual locale code of your locale.</p>
<pre>$ compare-locales path/to/mozilla-1.9.2/.../l10n.ini pathto/l10n_base/ ab-CD
$ compare-locales mozilla-1.9.2/browser/locales/l10n.ini l10n-mozilla-1.9.2 ab-CD &gt; ~/Desktop/ab-CD.compare
</pre>
<p>Open the ab-CD.compare file that is on your desktop.  You should see something like this:</p>
<pre>ab-CD
  browser
    chrome
      browser
        .DS_Store
            // add and localize this file
        aboutCertError.dtd
            // add and localize this file
        aboutDialog.dtd
            +aboutLink
            +aboutLink.accesskey
            +aboutVersion
            +closeCmdGNOME.accesskey
            +closeCmdGNOME.label
            +copyright
            +copyright.accesskey
            +copyrightGNOME.accesskey
            +copyrightInfo1
            +copyrightInfo2
            +licenseLink
            +licenseLinkText
        aboutPrivateBrowsing.dtd
            // add and localize this file
        aboutRobots.dtd
            // add and localize this file
        ...
        ...
        ...
ab-CD:
unchanged: 2
changed: 3
missingInFiles: 6117
missing: 13
0% of entries changed
</pre>
<p>The beauty of the compare-locales output is that it tells you all the missing files and which files you need to add and localize.  This will be your guide to localize Firefox.</p>
<h2>Localizing Step-by-Step</h2>
<p>With your compare-locales output open for review, we will start with the first file with "// add and localize this file" note.  You should see</p>
<pre> // add and localize this file
        aboutCertError.dtd
</pre>
<p>Notice from the compare-locales output that this file is located in the directory /browser/chrome/browser.  You will want to copy this file from the en-US sources into the proper ab-CD directory. To do this, you first need to create the directory structure and then copy the file into it.  Type the command</p>
<pre>pwd
</pre>
<p>to make sure you are in</p>
<pre>/path/to/your/working/directory</pre>
<p>And then type the command</p>
<pre>mkdir /browser/chrome/browser
</pre>
<p>Now, copy the file by typing</p>
<pre>cp -R mozilla-1.9.2/browser/locales/en-US/chrome/browser/aboutCertError.dtd ab-CD/browser/chrome/browser/aboutCertError.dtd</pre>
<p>You should now see the aboutCertError.dtd file in that newly created directory.  Your compare locales output follows the exact nested source structure.  Each time you see a directory or set of sub-directories, you will need to run the mkdir command inside your locale directory and then copy the .dtd or property files into that directory.</p><h2>Translating</h2>
<p>To start editing, you will need a text editing application. You can choose to use:</p>
<ul> <li><a class=" external" href="http://notepad-plus.sourceforge.net/uk/site.htm" title="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> or <a class=" external" href="http://www.flos-freeware.ch/notepad2.html" title="http://www.flos-freeware.ch/notepad2.html">Notepad2</a> on Windows,</li> <li><a class=" external" href="http://en.wikipedia.org/wiki/Vim_%28text_editor%29" title="http://en.wikipedia.org/wiki/Vim_(text_editor)">vim</a>, <a class=" external" href="http://projects.gnome.org/gedit/" title="http://projects.gnome.org/gedit/">gedit</a> or <a class="    external" href="http://www.kate-editor.org/kate" title="http://www.kate-editor.org/kate">Kate</a> on GNU/Linux,</li> <li><a class=" external" href="http://www.barebones.com/products/TextWrangler/" title="http://www.barebones.com/products/TextWrangler/">TextWrangler</a> on Mac OS X.</li>
</ul>
<p><span style="font-size: x-small;">(Read more about tools at </span><a class=" link-https" href="https://wiki.mozilla.org/L10n:Tools" title="https://wiki.mozilla.org/L10n:Tools"><span style="font-size: x-small;">L10n:Tools</span></a><span style="font-size: x-small;">.)</span></p>
<p>After you have downloaded your editor of choice, type the following command in the same path from above (~/ab-CD/browser/chrome/browser)</p>
<pre>$ edit ab-CD/browser/chrome/browser/aboutCertError.dtd</pre>
<p>Read the top of the file to get any context on how to translate contained in the notes written by the developers or l10n-drivers.  Localization notes will look like this:</p>
<pre>&lt;!-- LOCALIZATION NOTES... --&gt;</pre>
<p>After the localization notes, you will see a list of <code>&lt;!ENTITY&gt;</code> strings like the following:</p>
<pre>&lt;!ENTITY certerror.pagetitle  "Untrusted Connection"&gt;</pre>
<p>You should go through each entity, translating  the value in the parameters (e.g. <code>Untrusted Connection</code> in the example above), like so (example for Polish):</p>
<pre>&lt;!ENTITY certerror.pagetitle  "Niezaufane połączenie"&gt;</pre>
<p>Once you have translated all the <code>&lt;!ENTITY&gt;</code> strings in this file, you should save your work and open the next .dtd or .property file.  You will need to go through each and every file to in every directory in ab-CD.</p>
<h2>Recommended order of localization</h2>
<p>For recommended order of localization, refer to the localization "phase list" which provides a very rough guide on where to start and in what order to proceed through translation.</p>
<ul> <li><a class=" external" href="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/" title="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/">The localization phase lists</a> (Firefox 3.5: <a class=" external" href="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/ff35.phaselist?view=markup" title="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/ff35.phaselist?view=markup">ff35.phaselist</a>, Firefox 3.6: <a class=" external" href="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/ff36.phaselist?view=markup" title="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/ff36.phaselist?view=markup">ff36.phaselist</a>).</li> <li><a class=" external" href="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/phases?view=markup" title="http://zaf.svn.sourceforge.net/viewvc/zaf/trunk/po/fftb/phases?view=markup">Description of phases.</a></li>
</ul>
<p>Land your translated files one by one, making sure it follows the *mozilla-1.9.2* structure.  This will familiarize you with our "Hg"<br>
commands and will get us something that we can import easily when you are done.</p>
Revert to this revision