Visit Mozilla.org

Patching a Localization

From MDC

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.

Contents

[edit] 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.

[edit] 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 fa for Persian as an example here.

The next thing you need to know is which localization you want to patch, let's take Firefox 3 as an example. Now let's get concrete, you should have a bash open and a clean directory to do your work in (it shouldn't have whitespace in it's path):

  • Check out client.mk
cvs -z3 -d:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk
  • Check out l10n tools
cvs -z3 -d:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/tools/l10n
  • Check out localized files
cd mozilla
make -f client.mk l10n-checkout MOZ_CO_PROJECT=browser MOZ_CO_LOCALES=fa

If you're following the development closely, you will want to update your local copy on a regular basis, so let's make things slightly simpler, and create a file called .mozconfig in the mozilla dir. It should look like this

mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_CO_LOCALES=fa
# if you have cvs write access to the l10n repository,
# adjust the following line and remove the leading #
#mk_add_options LOCALES_CVSROOT=username%mail.tld@cvs.mozilla.org:/l10n
mk_add_options LOCALES_CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/l10n

# The following is to create language packs and repackage builds
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../firefox
ac_add_options --disable-compile-environment
ac_add_options --enable-application=browser


[edit] Add your changes

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

We should fill in detail as needed and appropriate here.

[edit] Testing

Link to repackaging documentation here.

[edit] Creating a patch

You create a patch with the following steps:

  • Go to your localization directory, or a subdirectory of that which holds the changes you're interested in
cd ../l10n/fa
  • Create the patch
cvs -z3 diff -u

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.

  • Attach the patch for reference or review
cvs -z3 diff -u > path/to/patchfile