Patching a Localization

  • Revision slug: Patching_a_Localization
  • Revision title: Patching a Localization
  • Revision id: 52414
  • Created:
  • Creator: AxelHecht
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

Let's walk through the steps to take to create a patch for an existing localization. The steps should work pretty similar for Firefox, Thunderbird, SeaMonkey, or Calendar, though I'll focus on Firefox, and let you figure out the rest. This document is work in progress.

Prerequisites

There is a basic set of tools that we'll assume you to have, you can find the list and how to get them on the L10n Prerequisites page.

Get the source

Firstly, you'll need to get the source for the localization in question. You need to know the language code, I'll be using gl for Galician as an example here.

The next thing you need to know is which localization you want to patch, let's take Firefox 3.6 as an example. 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 concrete, start bash and:

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

mkdir ~/localization-workdir
  • Go to this directory:
cd ~/localization-workdir
  • Clone the localization repository for your locale and for the version you want to patch:
hg clone http://hg.mozilla.org/release/l10n-mozilla-1.9.2/gl/

Add your changes

Now you can edit the DTD and properties files to make the changes you intend to do.

Creating a patch

You create a patch with the following steps:

  • Go to your localization directory
cd ~/localization-workdir/gd
  • Create the patch
hg diff

This will list the differences in a unified patch to stdout. You can visually inspect if this is what you intended to do, as a good patch only contains those changes that you intend. If it contains more, you'll likely regress something else.

  • Alternatively, you can only show differences in selected files by doing:
hg diff browser/chrome/browser/browser.dtd
  • Attach the patch for reference or review in an existing bug or create a new one.
hg diff > path/to/patchfile

Revision Source

<p>Let's walk through the steps to take to create a patch for an existing localization. The steps should work pretty similar for Firefox, Thunderbird, SeaMonkey, or Calendar, though I'll focus on Firefox, and let you figure out the rest. This document is work in progress.</p>
<h2 name="Prerequisites">Prerequisites</h2>
<p>There is a basic set of tools that we'll assume you to have, you can find the list and how to get them on the <a href="/en/Localization_prerequisites" title="en/L10n_Prerequisites">L10n Prerequisites</a> page.</p>
<h2 name="Get_the_source">Get the source</h2>
<p>Firstly, you'll need to get the source for the localization in question. You need to know the language code, I'll be using <code>gl</code> for Galician as an example here.</p>
<p>The next thing you need to know is which localization you want to patch, let's take Firefox 3.6 as an example. 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 concrete, start bash and:</p>
<ul> <li> <p>Create a clean directory to do your work.  For example, create a directory like <code>localization-workdir</code> (in this example it is located in your home directory):</p> </li>
</ul>
<pre>mkdir ~/localization-workdir
</pre>
<ul> <li>Go to this directory:</li>
</ul>
<pre>cd ~/localization-workdir</pre>
<ul> <li>Clone the localization repository for your locale and for the version you want to patch:</li>
</ul>
<pre class="eval">hg clone <a class=" external" href="http://hg.mozilla.org/release/l10n-mozilla-1.9.2/gl/" rel="freelink">http://hg.mozilla.org/release/l10n-mozilla-1.9.2/gl/</a>
</pre>
<h2 name="Add_your_changes">Add your changes</h2>
<p>Now you can edit the DTD and properties files to make the changes you intend to do.</p>
<h2 name="Creating_a_patch">Creating a patch</h2>
<p>You create a patch with the following steps:</p>
<ul> <li>Go to your localization directory</li>
</ul>
<pre>cd ~/localization-workdir/gd</pre>
<ul> <li>Create the patch</li>
</ul>
<pre class="eval">hg diff
</pre>
<p>This will list the differences in a unified patch to stdout. You can visually inspect if this is what you intended to do, as a good patch only contains those changes that you intend. If it contains more, you'll likely regress something else.</p>
<ul> <li>Alternatively, you can only show differences in selected files by doing:</li>
</ul>
<pre>hg diff browser/chrome/browser/browser.dtd
</pre>
<ul> <li>Attach the patch for reference or review in an existing bug 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>.</li>
</ul>
<pre class="eval">hg diff &gt; path/to/patchfile
</pre>
Revert to this revision