Differences between revisions 42 and 91 (spanning 49 versions)
Revision 42 as of 2009-06-21 21:31:15
Size: 8184
Comment: Import from TortoiseHg
Revision 91 as of 2014-05-07 07:41:20
Size: 11840
Comment: Formatting as per WikiStyleGuide
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
Line 9: Line 8:
If you find that Mercurial is not yet translated into your favorite language, then you can start one. First look at the bottom of this page or contact the development MailingList to see if an effort is already underway. There is also the [[http://www.transifex.net/projects/p/mercurial/|Transifex]] listing.
Line 10: Line 10:
If you find that Mercurial is not yet translated into your favorite language, then you can start one. First look at the bottom of this page or contact the development MailingList to see if an effort is already underway. There is also the [[http://www.transifex.net/projects/mercurial/|Transifex]] listing. Translations are stored as ''`xx.po`'' and ''`xx_yy.po`'' files in the ''`i18n/`'' directory. The `xx` corresponds to the language code of the translation and the `yy` is the optional country code. Find your language code in the [[http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html|ISO 639-1 list]] and, if needed, your country code in [[http://www.gnu.org/software/gettext/manual/html_node/Country-Codes.html|ISO 3166 list]]. Most translations only use a language code.
Line 12: Line 12:
Translations are stored as `xx.po` and `xx_yy.po` files in the `i18n/` directory. The `xx` corresponds to the language code of the translation and the `yy` is the optional country code. Find your language code in the [[http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html|ISO 639-1 list]] and, if needed, your country code in [[http://www.gnu.org/software/gettext/manual/html_node/Country-Codes.html|ISO 3166 list]].

To create a new translation you first create a `i18n/hg.pot` file. This is can be done with the Makefile:
To create a new translation you first create a ''`i18n/hg.pot`'' file. This is can be done with the Makefile:
Line 19: Line 17:
You create your translation from the ''`hg.pot`'' file. You can use the `msginit` program to start a new translation or you can copy the ''`hg.pot`'' file to the correct ''`xx.po`'' name. If you copy it by hand, please set the `Language` header to `xx`.
Line 20: Line 19:
You create your translation from the `hg.pot` file. You can use the `msginit` program to start a new translation or you can copy the `hg.pot` file to the correct `xx.po` name. Now edit the ''`xx.po`'' file with your favorite PO editor, such as [[http://www.poedit.net/|Poedit]], Emacs, or [[https://www.google.com/search?q=po+editor|some other PO editor]]. You can also simply edit the ''`xx.po`'' file with a text editor (such as !WordPad), but you must then be careful to keep the formatting.
Line 22: Line 21:
Now edit the `xx.po` file with your favorite PO editor, such as [[http://www.poedit.net/|Poedit]] or Emacs. You can also simply edit the `xx.po` file with a text editor (such as !WordPad), but you must then be careful to keep the formatting. To actually use the translation you need to compile the ''`xx.po`'' file into a ''`xx.mo`''. If you have the `msgfmt` program installed you can do the compilation like this:
Line 24: Line 23:
To actually use the translation you need to compile the `xx.po` file into a `xx.mo`
If you have the `msgfmt` program installed you can do the compilation like this:
Line 29: Line 26:
Alternatively, you can let Poedit or another PO editor do the compilation. The resulting file should be called ''`hg.mo`'' and must be saved as
Line 30: Line 28:
Alternatively, you can let Poedit or another PO editor do the compilation. The resulting file should be called `hg.mo` and must be saved as
Line 34: Line 31:
Using `setup.py` does this for you, if you compiled the `xx.po` file manually you have to create the directory structure yourself. If you use ''`setup.py`'', the file is automatically saved here for you. If you compiled the ''`xx.po`'' file manually you have to create the directory structure yourself.
Line 36: Line 33:
Now ensure that your LANGUAGE environment variable is set to 'xx'. In a shell from the Bash-family you do this by: Now ensure that your `LANGUAGE` environment variable is set to `xx`. In a shell from the Bash-family you do this by:
Line 44: Line 42:
When changes are made to the Mercurial source, new strings will appear that must be translated. Updating an old translation to take these strings into account is easy: regenerate the `hg.pot` file as above and use the `msgmerge` program to merge new strings into the translation: /!\ Translations can have their own working repository, check first the proper repository to be cloned before starting.

When changes are made to the Mercurial source, new strings will appear that must be translated. Updating an old translation to take these strings into account is easy: regenerate the ''`hg.pot`'' file as above and use the `msgmerge` program to merge new strings into the translation:
Line 48: Line 49:
Another way is to call make with the po-file
Line 49: Line 51:
Antother way is to call make with the po-file
Line 53: Line 54:
This combines the regeneration of ''`hg.pot`'' and `msgmerge`.
Line 54: Line 56:
This combines the regeneration of `hg.pot` and `msgmerge`. Then translate the new strings, make the ''`xx.mo`'' file and enjoy. When you commit the updated translation, use
Line 56: Line 58:
{{{
i18n-xx: synchronized with NODE
}}}
where `NODE` is either the changeset hash of your working copy parent revision before the commit or (better) the hash of its most recent ancestor that changed a translated message.
Line 57: Line 63:
Then translate the new strings, make the `xx.mo` file and enjoy.

If you prefer to have the location information present while working on the translation, then leave out the {{{--no-location}}} flag above. The location info from `hg.pot` will then be merged into the `xx.po` file and you will be able to quickly jump to the source fo a given translation.
If you prefer to have the location information present while working on the translation, then leave out the {{{--no-location}}} flag above. The location info from ''`hg.pot`'' will then be merged into the ''`xx.po`'' file and you will be able to quickly jump to the source for a given translation.
Line 62: Line 66:
Line 67: Line 72:
When you are happy with your translation, please notify MartinGeisler. The easiest way is to join #mercurial on irc.freenode.net (contact mg) and provide a URL where the update can be pulled from. He will then push the changes to the [[http://bitbucket.org/mg/mercurial-i18n/|mercurial-i18n queue]] from where they will eventually be pulled into the main repository. == Submitting ==
If you are making a new translation, then please notify MartinGeisler. The easiest way is to join {{{#mercurial}}} on {{{irc.freenode.net}}} and contact {{{mg}}} with a URL where the update can be pulled from. He will then push the changes to the [[http://bitbucket.org/mg/hg-i18n/|i18n queue]] from where they will eventually be pulled into the main repository.

You should commit your changes to the '''stable''' branch, so update to that branch before starting. This will ensure that your translations will be available on the next tagged release in at most a month, so it'll reach users (and hopefully get feedback) earlier.

/!\ '''Do not merge across branches''', since that could inadvertently propagate unwanted code changes.

Your commit messages should have this format:

{{{
i18n-xx: short description
}}}
For a new translation, the first changesets could look like this:

{{{
i18n-xx: new translation
i18n-xx: translated add, log, diff
i18n-xx: translated status
}}}

Please rebase your changesets on top of the stable branch before pushing them to the hg-i18n repository (use `hg rebase`). That will keep the number of merges to a minimum and simplify the history graph.

In general, your working cycle can look like this:

 * modify ''`xx.po`'' and commit it (in your `xx` repository)
 * once in a while (especially before pushing), do a '`hg pull --rebase`'
 * run '`make local`' to rebuild the ''`.mo`'' files
 * test your translation with '`./hg`' (make sure first that `$LANGUAGE` equals `xx`)
 * run '`make test-gendoc.t`' to make sure that you don't introduce reStructuredText syntax errors (you will need docutils for that, e.g. package {{{python-docutils}}} in Debian/Ubuntu)
 * when you are happy with your translation push it to hg-i18n
Line 70: Line 104:
The translations of command help texts should be word-wrapped at 78 characters. Please follow this pattern:
Line 71: Line 106:
The translations of command help texts should be word-wrapped at 70 characters. Please follow this pattern:
Line 75: Line 109:
    Larger description of the command. Each paragraph should be
   
word-wrapped at 70 characters and indented with 4 spaces.
    Larger description of the command. Each paragraph should be word-wrapped
   
at 70 characters and indented with 4 spaces.
Line 78: Line 112:
    Paragraphs are separated by a single empty line. Use a single
   
space between sentences.
    Paragraphs are separated by a single empty line. Use a single space
   
between sentences.
Line 81: Line 115:
Line 83: Line 116:
Line 86: Line 118:
=== Possible repository setup ===
Although you can use any repository to keep track of your translation progress, the following setup may prove handy:

 * create a Bitbucket repository by forking the [[http://bitbucket.org/mg/hg-i18n/|i18n queue]]; you need a [[http://bitbucket.org/|Bitbucket]] account for that
 * clone that repository on your machine
 * work on the clone: edit, commit, pull changes from the [[http://bitbucket.org/mg/hg-i18n/|i18n queue]] with `hg pull --rebase` (that also updates your local repository)
 * push your changes to the fork repository
 * let MartinGeisler know where your fork lies, and he'll push the changes to the [[http://bitbucket.org/mg/hg-i18n/|i18n queue]]

When you will have the rights to do it, you will be able to push your changes directly to [[http://bitbucket.org/mg/hg-i18n/|i18n queue]] (and you may discontinue your fork, if you wish so).
Line 87: Line 130:
The [[http://bitbucket.org/tortoisehg/stable/wiki/Home|TortoiseHg]] project has made a number of translations and about 50 of the strings from their project overlap with the strings in Mercurial. To reuse them, start by downloading the latest version for your language. The URL are of this form:
Line 88: Line 132:
The [[http://bitbucket.org/tortoisehg/stable/wiki/Home|TortoiseHg]] project has made a number of translations and about 50 of the strings from their project overlap with the strings in Mercurial. To reuse them, start by downloading the latest version for your language. The URL are of this form:
Line 90: Line 133:
http://bitbucket.org/tortoisehg/crew/raw/tip/i18n/tortoisehg-xx.po http://bitbucket.org/tortoisehg/stable/raw/tip/i18n/tortoisehg/xx.po
Line 92: Line 135:
Use {{{wget}}} or your browser to download the file and save it to the {{{i18n}}} folder. Then extract the strings common to both translations: Use {{{wget}}} or your browser to download the file and save it as {{{tortoise-xx.po }}}to the {{{i18n}}} folder. Then extract the strings common to both translations:
Line 94: Line 138:
msgcomm tortoisehg-xx.po xx.po -o common-xx.po msgcomm tortoisehg-xx.po hg.pot -o common-xx.po
Line 96: Line 140:
It is important to list the {{{tortoisehg-xx.po}}} file first since each translation is taken from that file. Now concatenate the two files using {{{msgcat}}}: It is important to list the ''`tortoisehg-xx.po`'' file first since each translation is taken from that file. Now concatenate the two files using {{{msgcat}}}:
Line 98: Line 143:
msgcat --no-location xx.po tortoisehg-xx.po -o xx.po msgcat --no-location hg.pot common-xx.po xx.po -o xx.po
Line 100: Line 145:
The ''`hg.pot`'' file is there to ensure that the strings remain in the order given in that file.
Line 101: Line 147:
Some of the translations may conflict between the two projects. This is marked like this in the {{{xx.po}}} file (this is from the German translation): Some of the translations may conflict between the two projects. This is marked like this in the ''`xx.po`'' file (this is from the German translation):
Line 110: Line 157:
You must go through the {{{xx.po}}} file and resolve these conflicts. In the example above, the translation for Mercurial used "Unbekannte Antword" whereas the translation for TortoiseHg used "nicht erkannte antwort". Delete the lines marked with "{{{#-#-#-#-#}}}" and delete the translation you don't like. Talk to the TortoiseHg translator and try to agree on a common terminology --- that will make future imports easier for both of you. You must go through the ''`xx.po`'' file and resolve these conflicts. In the example above, the translation for Mercurial used "Unbekannte Antword" whereas the translation for TortoiseHg used "nicht erkannte antwort". Delete the lines marked with "{{{#-#-#-#-#}}}" and delete the translation you don't like. Talk to the TortoiseHg translator and try to agree on a common terminology --- that will make future imports easier for both of you.
Line 113: Line 160:
Line 116: Line 162:
You simply have to enable the extension and then use Mercurial like normal. Use {{{hg i18nstat}}} to dump the accumulated statistics. When you translate one of the missing strings, it will disappear from the statistics the next time it is used (the extension wont notice that it is translated unless the string is used).

You simply have to enable the extension and then use Mercurial like normal. Use '`hg i18nstat`' to dump the accumulated statistics. When you translate one of the missing strings, it will disappear from the statistics the next time it is used (the extension wont notice that it is translated unless the string is used).
Line 121: Line 165:
Translations distributed with Mercurial (see also the [[http://www.transifex.net/projects/p/mercurial/|Transifex]] listing):
Line 122: Line 167:
Translations distributed with Mercurial (see also the [[http://www.transifex.net/projects/mercurial/|Transifex]] listing):

 * Brazilian Portuguese (WagnerBruna)
 * Danish (MartinGeisler)
 * German (TobiasBell) -- Development takes place at http://bitbucket.org/tobidope/mercurial-german-translation/
 * Italian (StefanoTortarolo)
 * [[BrazilianPortugueseTranslation|Brazilian Portuguese]] (WagnerBruna)
 * [[CzechTranslation|Czech]] (Tovim)
 * [[DanishTranslation|Danish]] (MartinGeisler)
 * French Mercurial (CedricDuval) -- repository: https://bitbucket.org/cedric/mercurial-l10n-fr/ (same mailing list as for the French hgbook)
 * [[GermanTranslation|German]]
 * [[GreekTranslation|Greek]] (GiorgosKeramidas)
 * Italian (StefanoTortarolo) -- Development takes place at http://bitbucket.org/astratto/hg-i18n-it/
Line 129: Line 175:
 * Simplified Chinese (DongshengSong)  * [[TranslatingMercurialIntoRussian|Russian]] (AlexanderSauta) -- Development takes place at https://bitbucket.org/demosito/hg-i18n-ru
 * [[RomanianTranslation|Romanian]] (DanielDumitriu) -- Development takes place at http://bitbucket.org/dumitriu/hg-i18n-ro/
 * Simplified Chinese (DongshengSong) -- Development takes place at http://bitbucket.org/dongsheng/hg-i18n/
 * Traditional Chinese (ChiaHuanWu) -- Development takes place at https://bitbucket.org/hgcht/hg-cht-translation
 
Line 133: Line 183:
 * French hgbook (RomainPelisse) -- patch queue: http://bitbucket.org/rpelisse/hgbook-fr/ , dedicated mailing list : hgfr-subscribe@flibuste.net, archived at http://www.mail-archive.com/hgfr@flibuste.net/ (obviously, the mailing list is in French :) )
 * French Mercurial (CedricDuval) -- repository: https://bitbucket.org/cedric/mercurial-l10n-fr/ (same mailing list as for the book)
 * Greek (GiorgosKeramidas) -- repository: http://bitbucket.org/keramida/mercurial-i18n/
 * Traditional Chinese (Chia-Huan Wu) -- patch queue: http://bitbucket.org/willie/hg-cht-translation/
 * French hgbook (RomainPelisse) -- patch queue: http://bitbucket.org/rpelisse/hgbook-fr/ , dedicated mailing list : http://groups.google.com/group/hgfr (obviously, the mailing list is in French :) ). We created a dedicated page to help organize our work : (FrenchTranslation).
Line 140: Line 187:

----
CategoryTranslations

[[JapaneseTranslatingMercurial|日本語]]

Internationalizing Mercurial

This page will describe how you can help internationalize Mercurial by translating it into your language of choice. Mercurial uses the standard i18n Gettext infrastructure, and we will only give a quick introduction to it here. Please take a look at the Gettext manual if you are unfamiliar with translating software.

1. Starting a New Translation

If you find that Mercurial is not yet translated into your favorite language, then you can start one. First look at the bottom of this page or contact the development MailingList to see if an effort is already underway. There is also the Transifex listing.

Translations are stored as xx.po and xx_yy.po files in the i18n/ directory. The xx corresponds to the language code of the translation and the yy is the optional country code. Find your language code in the ISO 639-1 list and, if needed, your country code in ISO 3166 list. Most translations only use a language code.

To create a new translation you first create a i18n/hg.pot file. This is can be done with the Makefile:

% make update-pot

You create your translation from the hg.pot file. You can use the msginit program to start a new translation or you can copy the hg.pot file to the correct xx.po name. If you copy it by hand, please set the Language header to xx.

Now edit the xx.po file with your favorite PO editor, such as Poedit, Emacs, or some other PO editor. You can also simply edit the xx.po file with a text editor (such as WordPad), but you must then be careful to keep the formatting.

To actually use the translation you need to compile the xx.po file into a xx.mo. If you have the msgfmt program installed you can do the compilation like this:

% python setup.py build_mo

Alternatively, you can let Poedit or another PO editor do the compilation. The resulting file should be called hg.mo and must be saved as

locale/xx/LC_MESSAGES/hg.mo

If you use setup.py, the file is automatically saved here for you. If you compiled the xx.po file manually you have to create the directory structure yourself.

Now ensure that your LANGUAGE environment variable is set to xx. In a shell from the Bash-family you do this by:

% export LANGUAGE=xx

Then run hg to see if your translations are picked up.

2. Updating a Translation

/!\ Translations can have their own working repository, check first the proper repository to be cloned before starting.

When changes are made to the Mercurial source, new strings will appear that must be translated. Updating an old translation to take these strings into account is easy: regenerate the hg.pot file as above and use the msgmerge program to merge new strings into the translation:

msgmerge --no-location --update i18n/xx.po i18n/hg.pot

Another way is to call make with the po-file

make i18n/xx.po

This combines the regeneration of hg.pot and msgmerge.

Then translate the new strings, make the xx.mo file and enjoy. When you commit the updated translation, use

i18n-xx: synchronized with NODE

where NODE is either the changeset hash of your working copy parent revision before the commit or (better) the hash of its most recent ancestor that changed a translated message.

If you prefer to have the location information present while working on the translation, then leave out the --no-location flag above. The location info from hg.pot will then be merged into the xx.po file and you will be able to quickly jump to the source for a given translation.

To avoid creating excessive diffs you must strip out this information before committing your translation:

msgcat --no-location -o xx.po xx.po

You should always use hg diff to check that your patch contains only the necessary changes.

3. Submitting

If you are making a new translation, then please notify MartinGeisler. The easiest way is to join #mercurial on irc.freenode.net and contact mg with a URL where the update can be pulled from. He will then push the changes to the i18n queue from where they will eventually be pulled into the main repository.

You should commit your changes to the stable branch, so update to that branch before starting. This will ensure that your translations will be available on the next tagged release in at most a month, so it'll reach users (and hopefully get feedback) earlier.

/!\ Do not merge across branches, since that could inadvertently propagate unwanted code changes.

Your commit messages should have this format:

i18n-xx: short description

For a new translation, the first changesets could look like this:

i18n-xx: new translation
i18n-xx: translated add, log, diff
i18n-xx: translated status

Please rebase your changesets on top of the stable branch before pushing them to the hg-i18n repository (use hg rebase). That will keep the number of merges to a minimum and simplify the history graph.

In general, your working cycle can look like this:

  • modify xx.po and commit it (in your xx repository)

  • once in a while (especially before pushing), do a 'hg pull --rebase'

  • run 'make local' to rebuild the .mo files

  • test your translation with './hg' (make sure first that $LANGUAGE equals xx)

  • run 'make test-gendoc.t' to make sure that you don't introduce reStructuredText syntax errors (you will need docutils for that, e.g. package python-docutils in Debian/Ubuntu)

  • when you are happy with your translation push it to hg-i18n

4. Formatting

The translations of command help texts should be word-wrapped at 78 characters. Please follow this pattern:

short description, starting with lowercase

    Larger description of the command. Each paragraph should be word-wrapped
    at 70 characters and indented with 4 spaces.

    Paragraphs are separated by a single empty line. Use a single space
    between sentences.

5. Tips

List your tips and tricks here.

5.1. Possible repository setup

Although you can use any repository to keep track of your translation progress, the following setup may prove handy:

  • create a Bitbucket repository by forking the i18n queue; you need a Bitbucket account for that

  • clone that repository on your machine
  • work on the clone: edit, commit, pull changes from the i18n queue with hg pull --rebase (that also updates your local repository)

  • push your changes to the fork repository
  • let MartinGeisler know where your fork lies, and he'll push the changes to the i18n queue

When you will have the rights to do it, you will be able to push your changes directly to i18n queue (and you may discontinue your fork, if you wish so).

5.2. Importing strings from TortoiseHg

The TortoiseHg project has made a number of translations and about 50 of the strings from their project overlap with the strings in Mercurial. To reuse them, start by downloading the latest version for your language. The URL are of this form:

http://bitbucket.org/tortoisehg/stable/raw/tip/i18n/tortoisehg/xx.po

Use wget or your browser to download the file and save it as tortoise-xx.po to the i18n folder. Then extract the strings common to both translations:

msgcomm tortoisehg-xx.po hg.pot -o common-xx.po

It is important to list the tortoisehg-xx.po file first since each translation is taken from that file. Now concatenate the two files using msgcat:

msgcat --no-location hg.pot common-xx.po xx.po -o xx.po

The hg.pot file is there to ensure that the strings remain in the order given in that file.

Some of the translations may conflict between the two projects. This is marked like this in the xx.po file (this is from the German translation):

msgid "unrecognized response\n"
msgstr ""
"#-#-#-#-#  de.po (Mercurial)  #-#-#-#-#\n"
"Unbekannte Antwort\n"
"#-#-#-#-#  tortoisehg-de.po (tortoisehg)  #-#-#-#-#\n"
"nicht erkannte antwort\n"

You must go through the xx.po file and resolve these conflicts. In the example above, the translation for Mercurial used "Unbekannte Antword" whereas the translation for TortoiseHg used "nicht erkannte antwort". Delete the lines marked with "#-#-#-#-#" and delete the translation you don't like. Talk to the TortoiseHg translator and try to agree on a common terminology --- that will make future imports easier for both of you.

5.3. Attacking the most used strings first

In order to translate the most important strings first, you may want to use the i18nstat extension. This extension will log each string translated and count the number of times an untranslated string is used.

You simply have to enable the extension and then use Mercurial like normal. Use 'hg i18nstat' to dump the accumulated statistics. When you translate one of the missing strings, it will disappear from the statistics the next time it is used (the extension wont notice that it is translated unless the string is used).

6. Existing Translations

Translations distributed with Mercurial (see also the Transifex listing):

Translations not yet distributed with Mercurial:

Please contact the person listed above if you would like to help with a particular language. If you want to start a new translation, then add the language and your name to the list and go ahead.


CategoryTranslations

日本語

TranslatingMercurial (last edited 2016-04-06 22:23:52 by timeless)