Personal tools

Using Mozilla Translator

From MozillaWiki

Jump to: navigation, search

Contents

NOT FINISHED YET!!

Needs to be addapted for Firefox 3.1 and mercurial, so DO NOT USE YET

Glossary

[user] → is your actual user on Linux: guillermo, father, matt...

[product] → the name of the product you are going to translate: firefox, thunderbird, sunbird, flock, songbird...

[version] → actual version: trunk, 3.0.x, 1.0, 0.x ...


Setting up the enviroment

Install hg (Mercurial), diff (patches) and Meld

Open your distribution package manager and select: "hg", "diff" and "meld". You can skip Meld, but it is a nice merging and diff tool, you may use it in the future. Install them.

sudo apt-get install hg diff meld

(on Ubuntu or Debian)

Install Java

You need to download Java (from here) or install it from your repositories if you are using Linux:

sudo apt-get install java

(for Ubuntu or Debian OS, may vary for other systems)


Directory structure

Create a directory structure like this:

/home/[user]/bin/
                |run-mt.sh             (file, see below)
                |repo-hg.sh            (file, see below)
                |update-hg-mozilla.sh  (file, see below)
            /MT/
               |mt.jar (file, see below)
               |MT.sh (file, see below)
               /[product]/[version]/

Files and scripts

mt.jar: Download MT (not the sources!) from here. Extract MT5xx.jar to your /home/[user]/MT/ directory. Then, rename it from MT5xx.jar to mt.jar.

And then download [test this file]. Extract in a temp folder (maybe on your desktop for example). And:

run-mt.sh: Copy to /home/[user]/bin/

MT.sh: Copy the file to /home/[user]/MT/

repo-hg.sh: Copy to /home/[user]/bin/

Configuring hg to pull files

You need to configure your environment to work well with your existing ssh key and the new installed hg. You can read Mercurial FAQ on MDC to learn more about hg (the command-line tool for Mercurial), but I'm writing the tips to get working your setup.

Then, you should configure Mercurial before pulling the code. Your Mercurial configuration file (~/.hgrc) should have at least the following settings:

[ui]
username = Your Real Name <user@example.com>
merge = your-merge-program → in our case meld

[diff]
git = 1

[defaults]
diff=-p -U 8


Downloading en-US sources

Once we have prepared our system to get the sources and modify it, we need to pull the en-US sources.

Open a Terminal and go:

cd ~/MT/[product]/[version]/

(Note: ~ is a shurtcut and stays for /home/[user] )

For example:

cd ~/MT/firefox/3.1/

Now, we are going to use a nice work that Philippe from Mozilla France did in the first days of hg. He did it because mercurial doesn't allow to download only a few directories (this means that we couldn't check out only the "browser/locales/en-US" dir for example), so if we want the en-US localization, we need to download the whole repository, and for localizers, the 99.99% of these files, are junk for us.

hg clone http://hg.frenchmozilla.fr/

This will create a new directory in (our case) ~/MT/firefox/3.1/ called hg.frenchmozilla.fr. This only contains the en-US locale, which is around 4.7MB of data, instead of the 250MB only for mozilla-central (and more for comm-central and for future mobile-central).

Downloading ab-CD sources

You need to go to the directory we have created before. So, open a terminal:

cd ~/MT/[product]/[version]/

In our above example :

cd ~/MT/firefox/3.1/

and then, pull out the sources by:

hg clone http://hg.mozilla.org/l10n-central/[locale]/

for example:

hg clone http://hg.mozilla.org/l10n-central/es-ES/

This command will create a [locale] folder in your ~/MT/[product]/[version]/ directory.

Setting up MT structure

So, check if you have this folders in your user directory:

/home/[user]/bin/ → there should be at least this two scripts: run-mt.sh and update-hg-mozilla.sh
            /MT/
                |[product]/[version]/
                                    /hg.frenchmozilla.fr → folders like: browser, mail, suite, security, toolkit...
                                    /[locale] → the same as above: browser, mail, suite...

Now it depends of what are you going to translate, but PLEASE, maintain a clean environment. This means that you should have different product SEPARATELLY on each folder. Do not share the same folder for Firefox and Thunderbird or toolkit... It could be risky and the ghost of MozillaTranslator will appear!

Firefox

Open a new terminal and type (you should change the [version] tag):

mkdir -p ~/MT/firefox/[version]/mozilla/extensions
mkdir -p ~/MT/firefox/[version]/mozilla/other-licenses/branding

Now, we are going to create the symlinks to the en-US files, edit [version] (if instead of ~/ you use /home/[user]/ check also [user] ) :

!!!! Check 2nd point again

ln -s ~/MT/firefox/[version]/hg.frenchmozilla.fr/browser ~/MT/firefox/[version]/mozilla
ln -s ~/MT/firefox/[version]/hg.frenchmozilla.fr/extensions/reporter ~/MT/firefox/[version]/mozilla/extensions
ln -s ~/MT/firefox/[version]/hg.frenchmozilla.fr/other-licenses/branding/firefox ~/MT/firefox/[version]/mozilla/other-licenses/branding/firefox

Done, and check there were no errors. If so, we have our en-US tree done for MT, we are going to move to our [locale] folder.

mkdir -p ~/MT/firefox/[version]/l10n/[locale]/extensions
mkdir -p ~/MT/firefox/[version]/l10n/[locale]/other-licenses/branding

And now the symlinks as above:

ln -s ~/MT/firefox/[version]/[locale]/browser ~/MT/firefox/[version]/l10n/[locale]
ln -s ~/MT/firefox/[version]/[locale]/extensions/reporter ~/MT/firefox/[version]/l10n/[locale]/extensions
ln -s ~/MT/firefox/[version]/[locale]/other-licenses/branding/firefox ~/MT/firefox/[version]/l10n/[locale]/other-licenses/branding/firefox

Now, we have the perfect tree. And we need to set up Mozilla Translator

Thunderbird

[TBD, but it looks like Firefox]

Toolkit

[TBD, but it looks like Firefox]

Setting up Mozilla Translator

Close all terminals and folders. Clean your workspace. Please, close all, see your perfect desktop. You will see the easy (I mean the best ;) ) way to translate any Mozilla Product based on hg.

Open a terminal. And type (changing [product] and [version] for the values set up early):

run-mt.sh [product] [version]

Maybe,

run-mt.sh firefox 3.1

This command will open Mozilla Translator using the contents in ~/MT/firefox/3.1

Mozilla-Translator.png

Is this nice, isn't it?

Click on File > Setup, go to Import/Export and Check the

  • Replace en-US directories name by ab-CD on exporting/writing

Click Ok and it's done.

Click on File > Manage products and then in Add

Enter the name of the product. Firefox 3.1 for example

Fields:

Import original: mozilla
Import translation: l10n
Export translation: l10n

Mozilla-Translator-Edit-product.png

Click Ok and exit the window. Now click on File > Update product and then in Ok

Mozilla-Translator-Update-product.png

You will be prompted about the field you want to see when you are editing. For me, the most useful are (control and click):

File, Key, Text: Original, Text: Translated, Status, Comment and Fuzzy.

PUT YOUR LOCALE! For example es-ES. And click Ok.

You will see all the strings in your product. Could be 80 (Fennec) or maybe 8000 (Toolkit)

Now we need to import the existing translation, so Import > Import translation from CVS, click Ok, our locale should be filled automagically, and click Ok.

AND IT DOESN'T WORK!!!!

Now you need to change some things about the export path. Go to the Chrome view with Edit > Chrome view. In the left you will see the "Root" folder that contains a "Firefox 3.1" (or the name of your product). Open it, then open Platform neutral. You will see the different folder we created few minutes ago.

Click on one of them, and at right, click on Information. Put the same name in the field On Export CVS, export to.

Do the same with the rest of the directories (but not with the subdirectories of browser, other-licenses...! )

Mozilla-Translator-Edit-Export-CVS-folders.png

Now you are prepared to translate and export your work. Ctrl+Shift+A will show you all the problems that MT has encountered: unstranslated strings, different endings... And maybe you will see a window like that (not the same!):

Mozilla-Translator-All-problematic-strings.png

When you are done, File > Save Glossary and then Export > Export CVS translation. Click Ok to the next two windows, and... it's done!! You have your local repository updated!! But it's not the final, you need to upload the changes to the l10n-central repository.

Before updating your changes, you need to edit hg files to use your ssh key required by Mozilla to allow commiting in their repositories. I copy-paste the code that is here:

[begin] With mercurial you work in your own repository. After finishing a change or set of changes you should commit:

hg commit -m "message identifying the change (bug 555)"

Unlike CVS this won't send your changes to Mozilla's repository. First you need to push the changes. To push to l10n-central and other mozilla-hosted repositories you have to have committer access, and you must edit the file (your-local-hg-root)/.hg/hgrc (note, this is NOT your ~/.hgrc) to add this line (replacing email@host with your username at mozilla):

[paths]
default = http://hg.mozilla.org/l10n-central/ab-CD
default-push = ssh://hg.mozilla.org/l10n-central/ab-CD

You'll need to tell ssh which account to use for your pushes, too, by editing ~/.ssh/config and adding the lines

Host hg.mozilla.org
User user@host.domain

user@domain is your account, with a real @ instead of the % that you used for CVS. Afterwards you can push your work to the repository (and check the result on the dashboard)

hg push

[end]

Steps to update your locale when en-US changes

It's simple to update your translation. First of all you need to know if the en-US locale has changed. This is soooo easy to check. Visit the en-US repository and add it to your favourite RSS reader. If there is a update in the feed, it means that there is a update in the en-US files. And now, you need to update your local en-US files. Open a terminal and type:

update-repo-hg.sh

Wait until the end. That's it! You have the latest en-US changes in your own computer.

Now, open Mozilla Translator with the command we use in the above step:

run-mt.sh [product] [version]

Maybe,

run-mt.sh firefox 3.1

When MT opens, click on File > Update product. A new window containing all the new strings will be shown. Translate it, save the Glossary (use the menu File, do you remember?) and Export CVS translation in the Export menu.

Now, open a new terminal and go to your translation's folder:

cd ~/[product][version]/[locale]

Like that:

cd ~/firefox31/es-ES

See what are you going to update with

hg diff

If it's all correct, type:

hg commit -m "Some weird message explaining the change"

And, please, NOT FORGET TO DO THIS:

hg push

Done, your updated translation should be commited, and you can check this on: http://hg.mozilla.org/l10n-central/[locale] , changing your [locale] obviously.

Happy localization!