Patching a Localization

  • Revision slug: Patching_a_Localization
  • Revision title: Patching a Localization
  • Revision id: 52420
  • Created:
  • Creator: jbeatty
  • Is current revision? No
  • Comment 78 words added, 35 words removed

Revision Content

Say you have found a problem with an existing localization. More specifically, it's a problem with an already released localization. What do you do now? Well, you have come to the right place! This page will walk through creating a patch for an existing localization. The steps below are fairly generic; for the most part they apply to creating l10n patches for Firefox, Thunderbird, SeaMonkey, or Calendar.

I'll use Firefox in the example below to help you understand the general steps to creating a l10n patch.

Prerequisites

If you are to the point that you are patching existing localizations, we assume that you have the basic set of tools listed on the L10n Prerequisites wiki page. If you do not have these tools, take a few steps back, grab a cookie (because, let's face it, you deserve it for all of your work), and visit the L10n Prerequisites page. There you'll learn what tools you need, where to find them, and how to install them.

Get the source

First, you need to get the source for the localization in question using its two character ISO language code. For our example, I'll use gl (Galician).

Next thing you need to know is which localization version you want to patch. For this example, let's use Firefox 3.6. The branch name for this version is releases/l10n-mozilla-1.9.2. For more information about branches see L10n:Branches.

Now let's get a little more detailed. Start bash and do the following:

  1. Create a clean directory for your work. For example, create a directory like localization-workdir (in this example it is located in your home directory):

mkdir ~/localization-workdir
  1. Navigate to the directory you just created.
cd ~/localization-workdir
  1. Clone the localization repository for your locale and for the version you want to patch:
hg clone http://hg.mozilla.org/releases/l10n-mozilla-1.9.2
  1. Now that you have the code and your working directory, edit the DTD and properties files to make your necessary changes.

Creating a l10n patch

You've made your changes, now create your patch.

  1. Navigate to your working localization directory.
cd ~/localization-workdir/gd
  1. Create a patch (also known as a diff) using the diff command.
hg diff

This command creates a patch and lists the your modifications through displaying the differences in a unified patch's files. These modifications are printed to stdout (standard output).

  1. Visually inspect your modifications. A good patch only contains those changes that you intended to make. If it contains more, you'll likely regress something else.

     Alternatively, you can select specific files for diff to evaluate and print (see below). The command will only print the differences found in the selected files.

hg diff browser/chrome/browser/browser.dtd
  1. Attach the patch to an existing bug for reference or review or create a new one if one doesn't currently exist.
hg diff > path/to/patchfile

Revision Source

<p>Say you have found a problem with an existing localization. More specifically, it's a problem with an already released localization. What do you do now? Well, you have come to the right place! This page will walk through creating a patch for an existing localization. The steps below are fairly generic; for the most part they apply to creating l10n patches for Firefox, Thunderbird, SeaMonkey, or Calendar.</p>
<p>I'll use Firefox in the example below to help you understand the general steps to creating a l10n patch.</p>
<h2 name="Prerequisites">Prerequisites</h2>
<p>If you are to the point that you are patching existing localizations, we assume that you have the basic set of tools listed on the <a href="/en/Localization_prerequisites" title="en/L10n_Prerequisites">L10n Prerequisites</a> wiki page. If you do not have these tools, take a few steps back, grab a cookie (because, let's face it, you deserve it for all of your work), and visit the <a href="/en/Localization_prerequisites" title="en/Localization_prerequisites">L10n Prerequisites</a> page. There you'll learn what tools you need, where to find them, and how to install them.</p>
<h2 name="Get_the_source">Get the source</h2>
<p>First, you need to get the source for the localization in question using its two character ISO language code. For our example, I'll use <code>gl</code> (Galician).</p>
<p>Next thing you need to know is which localization version you want to patch. For this example, let's use Firefox 3.6. The branch name for this version is <code>releases/l10n-mozilla-1.9.2</code>. For more information about branches see <a class="external" href="http://wiki.mozilla.org/L10n:Branches" title="http://wiki.mozilla.org/L10n:Branches">L10n:Branches</a>.</p>
<p>Now let's get a little more detailed. Start bash and do the following:</p>
<ol> <li> <p>Create a clean directory for your work. For example, create a directory like <code>localization-workdir</code> (in this example it is located in your home directory):</p> </li>
</ol>
<pre>mkdir ~/localization-workdir
</pre>
<ol start="2"> <li>Navigate to the directory you just created.</li>
</ol>
<pre>cd ~/localization-workdir</pre>
<ol start="3"> <li>Clone the localization repository for your locale and for the version you want to patch:</li>
</ol>
<pre class="eval">hg clone <a class=" external" href="http://hg.mozilla.org/releases/l10n-mozilla-1.9.2" rel="freelink">http://hg.mozilla.org/releases/l10n-mozilla-1.9.2</a></pre>
<ol start="4"> <li>Now that you have the code and your working directory, edit the DTD and properties files to make your necessary changes.</li>
</ol>
<h2 name="Creating_a_patch">Creating a l10n patch</h2>
<p>You've made your changes, now create your patch.</p>
<ol> <li>Navigate to your working localization directory.</li>
</ol>
<pre>cd ~/localization-workdir/gd
</pre>
<ol start="2"> <li>Create a patch (also known as a diff) using the <code>diff</code> command.</li>
</ol>
<pre class="eval">hg diff
</pre>
<p>This command creates a patch and lists the your modifications through displaying the differences in a unified patch's files. These modifications are printed to stdout (standard output).</p>
<ol start="3"> <li>Visually inspect your modifications. A good patch only contains those changes that you intended to make. If it contains more, you'll likely regress something else.</li>
</ol>
<p style="margin-left: ;">     Alternatively, you can select specific files for <code>diff</code> to evaluate and print (see below). The command will only print the differences found in the selected files.</p>
<pre>hg diff browser/chrome/browser/browser.dtd
</pre>
<ol start="4"> <li>Attach the patch to an existing bug for reference or review or <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Localizations" title="https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla Localizations">create a new one</a> if one doesn't currently exist.</li>
</ol>
<pre class="eval">hg diff &gt; path/to/patchfile
</pre>
Revert to this revision