Patching a Localization

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 you 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 or three character ISO language code. For our example, I'll use gl (Galician). Whenever you see gl in blue text, replace it with the locale code for your language.

Next thing you need to know is which localization version you want to patch. All of our localizations work on the Aurora branch. The repository for this version is releases/l10n/mozilla-aurora. 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-aurora/gl
  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/gl
  1. Create a patch (also known as a diff) using the diff command.
hg diff

This command creates a patch and lists 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

Document Tags and Contributors

Tags: 
 Contributors to this page: teoli, alco, jbeatty, AxelHecht, sethb@mozilla.com, stasm
 Last updated by: teoli,