Difference between revisions of "WesnothTranslationsHowTo"

From The Battle for Wesnoth Wiki
(Rollback all edits by Marsianen.)
(Tools: updating all the files needs "po4a-update" and "manual" too)
 
(12 intermediate revisions by 7 users not shown)
Line 3: Line 3:
 
==  How to submit your translations  ==
 
==  How to submit your translations  ==
  
 +
Important:  Please '''do not submit translations as pull requests''' on the Wesnoth github repository site.  While that seems like a good idea, it causes potential complications that we cannot always easily resolve.  As a result, we cannot accept translations submitted via pull request and will close such PRs immediately.
  
 
'' ''' Translation Maintainers ''' ''
 
'' ''' Translation Maintainers ''' ''
Line 8: Line 9:
 
The translation maintainers should send the updated/new translation
 
The translation maintainers should send the updated/new translation
 
po-files to the language coordinator:
 
po-files to the language coordinator:
Ivanovic (crazy-ivanovic AT gmx DOT net) or
+
Ivanovic (crazy-ivanovic AT gmx DOT net).
Espreon (Majora700 AT gmail DOT com).
 
 
Additionally they have to quickly check over other people's translations
 
Additionally they have to quickly check over other people's translations
 
(other people translating the same language) as the other translators
 
(other people translating the same language) as the other translators
 
(if any) will have to send their translations to their language maintainer
 
(if any) will have to send their translations to their language maintainer
before inclusion in the SVN (the online source code repository). You should also subscribe to the [http://www.wesnoth.org/wiki/WesnothTranslations#Mailing_List wesnoth-i18n mailinglist].
+
before inclusion in the source-code repository. You should also subscribe to the [http://www.wesnoth.org/wiki/WesnothTranslations#Mailing_List wesnoth-i18n mailinglist].
  
 
Send the files as an archive containing the complete .po files (no .mo or .gmo files) and ensure that they follow the directory structure used in version control. For example, the archive with the German (de) translations should therefore be structured as follows:
 
Send the files as an archive containing the complete .po files (no .mo or .gmo files) and ensure that they follow the directory structure used in version control. For example, the archive with the German (de) translations should therefore be structured as follows:
Line 26: Line 26:
 
the maintainer for their language to see if there is some work to do.
 
the maintainer for their language to see if there is some work to do.
 
After you have done some work on the translation you should email it
 
After you have done some work on the translation you should email it
to your language maintainer. He/she will then (if needed) check it over
+
to your language maintainer. They will then (if needed) check it over
 
before sending it on to the language coordinators. A list of all translators
 
before sending it on to the language coordinators. A list of all translators
 
currently working on a language is found on each language page.
 
currently working on a language is found on each language page.
Line 35: Line 35:
 
contact the translation maintainer for the language.
 
contact the translation maintainer for the language.
 
If you want to start translation of Wesnoth to a new language,
 
If you want to start translation of Wesnoth to a new language,
first contact Ivanovic or Espreon.
+
first contact Ivanovic.
 
And then just follow the instructions written in '' Translators '' .
 
And then just follow the instructions written in '' Translators '' .
  
 
==  Translations How-To  ==
 
==  Translations How-To  ==
  
Notes:
+
If you are a translator, see [[GettextForTranslators]] for more information.
* If you haven't got Wesnoth from latest SVN, start out by doing so. Take a look at [[WesnothSVN]] for instructions about that.
+
 
* The old translation system, using cfg files and some wesnoth-specific tools (make_translation, merge_translation, weslang) was abandoned in the 0.8.3 release of Wesnoth in favor of the standard [[GetText|GNU GetText]] system.
+
If you are a developer or UMC author, gettext internals for Wesnoth are discussed here: [[GettextForWesnothDevelopers]]. For UMC authors, the tool for generating .po files is linked to from [[GettextForWesnothDevelopers#Generating the_.pot_and_.po_files_for_UMC]].
* Info about how the two branches do work can be found in the [http://www.wesnoth.org/forum/viewtopic.php?t=7618 Forum].
+
 
 +
=== Files ===
 +
 
 +
We will use the Swedish (sv) language and the ''wesnoth-editor'' domain as an example. There are three important files for each text-domain:
 +
* ''wesnoth-editor/wesnoth-editor.pot'' file, which is a template containing all the strings used in the domain, but with empty strings instead of a translation. You can see how a ''.pot'' file looks like in the repository : [https://github.com/wesnoth/wesnoth/blob/master/po/wesnoth-editor/wesnoth-editor.pot#L50 Current repository version].
 +
* ''wesnoth-editor/sv.po'', the file containing the translation, you can see how a ''.po'' file looks like in the repository: [https://github.com/wesnoth/wesnoth/blob/master/po/wesnoth-editor/sv.po#L50 Current repository version].
 +
* ''{translations_dir}/sv/LC_MESSAGES/wesnoth-editor.mo'', which is a binary version of <lang>.po that the game will use for efficiency reasons. This is not found in the repo, but is created during compilation of the game.
 +
 
 +
The first of these files, we update every once in a while, when there is new or modified text,
 +
for instance when a new campaign scenario hits the repository.
 +
 
 +
=== Tools ===
 +
 
 +
For the main Wesnoth repository, the build system can handle updating these files.
 +
* Using SCons, '''scons pot-update po4a-update manual''' will do everything. This can be done without building the Wesnoth executables.
 +
** '''scons -j8 pot-update po4a-update manual''' is quicker, because it does it in parallel.
 +
** '''scons -j8 pot-update''' will do all in-game text, omitting the manpages and manual
 +
* Using CMake, enable '''ENABLE_NLS''' and '''ENABLE_POT_UPDATE_TARGET''', then run '''make -C po pot-update''' to generate the files.
 +
 
 +
Some notes on the individual steps that are used during the build:
 +
 
 +
C++ and Python files are parsed with ''xgettext'', WML and Lua files are parsed with ''wmlxgettext''. The results are then combined to generate the ''.pot'' file.
 +
 
 +
Then, ''msgmerge'' is used to merge this new "state of the game strings" with your current translations, and generate a new, up-to-date, ''sv.po''.
  
If you are a translator, see [[GettextForTranslators]] for more information.
+
Then, a tool called ''msgfmt'' is called, which generates a new ''wesnoth.mo'' file from your ''wesnoth.po'' file, which will be used by the game once installed.
 +
 
 +
=== Summary ===
 +
 
 +
That was for the "Big Picture".
 +
But you really just need to be concerned with the po file:
 +
translating new strings, checking "fuzzy" entries.
 +
We can handle the administrative tasks of updating etc.
 +
You really don't need to bother with any of these commands, unless you want to compile .mo files to check in-game.
  
If you are a developer, gettext internals for Wesnoth are discussed here: [[GettextForWesnothDevelopers]].
+
Ivanovic is now responsible for integrating translations into Wesnoth, with the help of Torangan and ott.
 +
You should contact Ivanovic (crazy-ivanovic AT gmx DOT net), and he'll put them in the game.
  
 
==  Specifying typefaces and fonts for a translation  ==
 
==  Specifying typefaces and fonts for a translation  ==
  
Translations in a language which mainly uses characters outside of the Latin1 character set may want to specify different typefaces. In the translatable strings, there is a string named
+
Translations in a language which use characters outside of the Latin, Greek and Cyrillic character sets may want to specify different typefaces. There are some translatable strings in data/hardwired/fonts.cfg which specify the fonts to use; these strings appear in the ''wesnoth'' text domain, and can be configured by putting the required fonts' names as the translations.
  "DejaVuSans.ttf,wqy-zenhei.ttc"
+
 
which specifies the order in which fonts are to be tried, for each character, before the program finds a font which contains this character: the font appearing first in the list is tried first. Translators may change this string in the translation.
+
Note the documentation in data/hardwired/fonts.cfg.
For example, it would be a good idea to specify first a font which contains all the characters generally used in the target language. This is especially important for translations into Asian languages.
 
If you have to add a font that is not listed in the main font list, just add it in your translation of this string and do '''not''' alter the original string (or your translation of the string won't work...).
 
  
 
== See Also ==
 
== See Also ==
Line 62: Line 92:
 
* [[TranslatorsGuide]]
 
* [[TranslatorsGuide]]
 
* [http://gettext.wesnoth.org Translation statistics]
 
* [http://gettext.wesnoth.org Translation statistics]
* [[TranslationSpellcheckingOnWindows]]
 
  
 
[[Category:Translations]]
 
[[Category:Translations]]

Latest revision as of 15:54, 2 March 2024

This page contains information on how-to translate and submit translation updates.

How to submit your translations

Important: Please do not submit translations as pull requests on the Wesnoth github repository site. While that seems like a good idea, it causes potential complications that we cannot always easily resolve. As a result, we cannot accept translations submitted via pull request and will close such PRs immediately.

Translation Maintainers

The translation maintainers should send the updated/new translation po-files to the language coordinator: Ivanovic (crazy-ivanovic AT gmx DOT net). Additionally they have to quickly check over other people's translations (other people translating the same language) as the other translators (if any) will have to send their translations to their language maintainer before inclusion in the source-code repository. You should also subscribe to the wesnoth-i18n mailinglist.

Send the files as an archive containing the complete .po files (no .mo or .gmo files) and ensure that they follow the directory structure used in version control. For example, the archive with the German (de) translations should therefore be structured as follows:

wesnoth/de.po
wesnoth-httt/de.po 
wesnoth-tutorial/de.po

etc.

Translators

The other translators (those who are not maintainers) should contact the maintainer for their language to see if there is some work to do. After you have done some work on the translation you should email it to your language maintainer. They will then (if needed) check it over before sending it on to the language coordinators. A list of all translators currently working on a language is found on each language page.

NEW Translators

If you want to help out with the translation of an language already started on, contact the translation maintainer for the language. If you want to start translation of Wesnoth to a new language, first contact Ivanovic. And then just follow the instructions written in Translators .

Translations How-To

If you are a translator, see GettextForTranslators for more information.

If you are a developer or UMC author, gettext internals for Wesnoth are discussed here: GettextForWesnothDevelopers. For UMC authors, the tool for generating .po files is linked to from GettextForWesnothDevelopers#Generating the_.pot_and_.po_files_for_UMC.

Files

We will use the Swedish (sv) language and the wesnoth-editor domain as an example. There are three important files for each text-domain:

  • wesnoth-editor/wesnoth-editor.pot file, which is a template containing all the strings used in the domain, but with empty strings instead of a translation. You can see how a .pot file looks like in the repository : Current repository version.
  • wesnoth-editor/sv.po, the file containing the translation, you can see how a .po file looks like in the repository: Current repository version.
  • {translations_dir}/sv/LC_MESSAGES/wesnoth-editor.mo, which is a binary version of <lang>.po that the game will use for efficiency reasons. This is not found in the repo, but is created during compilation of the game.

The first of these files, we update every once in a while, when there is new or modified text, for instance when a new campaign scenario hits the repository.

Tools

For the main Wesnoth repository, the build system can handle updating these files.

  • Using SCons, scons pot-update po4a-update manual will do everything. This can be done without building the Wesnoth executables.
    • scons -j8 pot-update po4a-update manual is quicker, because it does it in parallel.
    • scons -j8 pot-update will do all in-game text, omitting the manpages and manual
  • Using CMake, enable ENABLE_NLS and ENABLE_POT_UPDATE_TARGET, then run make -C po pot-update to generate the files.

Some notes on the individual steps that are used during the build:

C++ and Python files are parsed with xgettext, WML and Lua files are parsed with wmlxgettext. The results are then combined to generate the .pot file.

Then, msgmerge is used to merge this new "state of the game strings" with your current translations, and generate a new, up-to-date, sv.po.

Then, a tool called msgfmt is called, which generates a new wesnoth.mo file from your wesnoth.po file, which will be used by the game once installed.

Summary

That was for the "Big Picture". But you really just need to be concerned with the po file: translating new strings, checking "fuzzy" entries. We can handle the administrative tasks of updating etc. You really don't need to bother with any of these commands, unless you want to compile .mo files to check in-game.

Ivanovic is now responsible for integrating translations into Wesnoth, with the help of Torangan and ott. You should contact Ivanovic (crazy-ivanovic AT gmx DOT net), and he'll put them in the game.

Specifying typefaces and fonts for a translation

Translations in a language which use characters outside of the Latin, Greek and Cyrillic character sets may want to specify different typefaces. There are some translatable strings in data/hardwired/fonts.cfg which specify the fonts to use; these strings appear in the wesnoth text domain, and can be configured by putting the required fonts' names as the translations.

Note the documentation in data/hardwired/fonts.cfg.

See Also

This page was last edited on 2 March 2024, at 15:54.