Difference between revisions of "HOWTO-Translate ScummVM GUI"

Jump to navigation Jump to search
(→‎Existing translations: Point wo translations web site)
(→‎Creating or Updating a translation file: Remove obsolete information)
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:


Please note that:
Please note that:
* The current implementation in ScummVM supports only single byte encoding. So don't use UTF-8 encoding for the po file. Latin1 (ISO 8859-1) is fine for most western european languages.
* Some strings are attached to a context (defined with msgctxt "context string" before the msgstr "translated text" in the po files). This means the same english string can be translated differently depending on the context. For example:
* Some strings are attached to a context (defined with msgctxt "context string" before the msgstr "translated text" in the po files). This means the same english string can be translated differently depending on the context. For example:
** "None" is defined with two different contexts: "path" and "soundfont". Therefore the translation can be different if needed depending if "None" refers to a path or a soundfont.
** "None" is defined with two different contexts: "path" and "soundfont". Therefore the translation can be different if needed depending if "None" refers to a path or a soundfont.
Line 12: Line 11:
* '%' character in a string denotes an argument. For example '%d' is an integer and '%s' is a string. They need to be kept unchanged in the translated string and furthermore their order has also to be kept.
* '%' character in a string denotes an argument. For example '%d' is an integer and '%s' is a string. They need to be kept unchanged in the translated string and furthermore their order has also to be kept.


The recommended way to translate ScummVM is to use the web site mentioned above. But you can also download the translations on your computer and work locally. You can get the existing translation files either from our GitHub repository(https://github.com/scummvm/scummvm/tree/master/po - click on the file you want and use the "raw" or "View Raw" button) or from our translation web site (https://translations.scummvm.org). When working locally, translations can be produced with the use of the [http://www.gnu.org/software/gettext/ GNU gettext tools]. To create or edit a translation file you can for example use [http://www.gnu.org/software/hello/manual/gettext/PO-Mode.html Emacs PO-Mode] or [http://www.poedit.net/ Poedit] which are both free and available for various platforms. See [[#Editing Tools|Editing Tools]] for more tools.
The recommended way to translate ScummVM is to use the https://translations.scummvm.org web site mentioned above.


Before starting a translation it would be a good idea to check [https://translations.scummvm.org/projects/scummvm/scummvm/ the list of existing translations] and to contact the team on the forum or IRC to know if other persons are already working on a translation for this language. That way if there is already a translation in the work you can avoid duplicate efforts and work together.
You can also download the translations on your computer and work locally. You can get the existing translation files either from our GitHub repository(https://github.com/scummvm/scummvm/tree/master/po - click on the file you want and use the "raw" or "View Raw" button) or from our translation web site (https://translations.scummvm.org). When working locally, translations can be produced with the use of the [http://www.gnu.org/software/gettext/ GNU gettext tools]. To create or edit a translation file you can for example use [http://www.gnu.org/software/hello/manual/gettext/PO-Mode.html Emacs PO-Mode] or [http://www.poedit.net/ Poedit] which are both free and available for various platforms. See [[#Editing Tools|Editing Tools]] for more tools. Then visit https://translations.scummvm.org to upload your updated po file.


For a new translation, use scummvm.pot (from [https://github.com/scummvm/scummvm/tree/master/po the source code repository]) as a template and fill out the header, or create the translation on https://translations.scummvm.org. Then you just have to translate the strings and save your work in a po file. To download the file, click on scummvm.pot and then the ''raw'' or ''View Raw'' button. If this tries to display the file in your browser, do a right click on that button and select ''Save target file as...'' (the working might be different depending on the browser). You might also need to remove any extension added by your browser (for example for me Safari downloads the file as ''scummvm.pot.pps'', apparently believing it to be a MS Powerpoint file).
Default users of the website can make suggestions and vote on the suggestions, but they cannot save translations or create new translations. Only official translators can start a new translations, accept suggestions and save changes to a translations. Thus if you want to start a translation for a new language you will need to speak to us. Also starting a translation it would be a good idea to check [https://translations.scummvm.org/projects/scummvm/scummvm/ the list of existing translations] and to contact the team on the forum or IRC to know if other persons are already working on a translation for this language. That way if there is already a translation in the work you can avoid duplicate efforts and work together.
 
You can also start your translation effort offline before it is added to the website by using the scummvm.pot (from [https://github.com/scummvm/scummvm/tree/master/po the source code repository]) as a template and fill out the header. Then you just have to translate the strings and save your work in a po file. To download the file, click on scummvm.pot and then the ''raw'' or ''View Raw'' button. If this tries to display the file in your browser, do a right click on that button and select ''Save target file as...'' (the working might be different depending on the browser). You might also need to remove any extension added by your browser (for example for me Safari downloads the file as ''scummvm.pot.pps'', apparently believing it to be a MS Powerpoint file).


You should also set the 'X-Language-name: Name\n' field in the header of the po file to indicate the name of the language in the ScummVM GUI. If not set, it will use the language code instead (for example 'de_DE' or 'fr_FR').
You should also set the 'X-Language-name: Name\n' field in the header of the po file to indicate the name of the language in the ScummVM GUI. If not set, it will use the language code instead (for example 'de_DE' or 'fr_FR').
Line 25: Line 26:
== Using the translation in ScummVM ==
== Using the translation in ScummVM ==


ScummVM does not use the po files directly. They need to be transformed into a ''translations.dat'' file instead. To use or test your translation you will therefore need regenerate that file.
ScummVM does not use the po files directly. They need to be transformed into a ''translations.dat'' file instead. To use or test your translation you will therefore need to regenerate that file.


=== Generate Translations Data file outside of ScummVM code repository ===
=== Generate Translations Data file outside of ScummVM code repository ===
This is the simplest option. Simply grab below one or the pre-compiled binary for the creation tool or compile it yourself. If you want to compile it yourself, you can get the source code from the [http://scummvm.svn.sourceforge.net/viewvc/scummvm/scummvm/trunk/ ScummVM source code repository] (in tools/create_translations/).  
This is the simplest option. Simply grab below one or the pre-compiled binary for the creation tool or compile it yourself. If you want to compile it yourself, you can get the source code from the [http://scummvm.svn.sourceforge.net/viewvc/scummvm/scummvm/trunk/ ScummVM source code repository] (in tools/create_translations/).  
<pre style="color: red">WARNING: The create_translations tools linked below are outdated and will not work with a recent version of ScummVM</pre>
* [http://wiki.scummvm.org/images/7/75/Create_translations_windows.zip create_translations tool for Windows]
* [http://wiki.scummvm.org/images/7/75/Create_translations_windows.zip create_translations tool for Windows]
* [http://wiki.scummvm.org/images/8/83/Create_translations_mac_10.6.zip create_translations tool for Mac OS X Snow Leopard]
* [http://wiki.scummvm.org/images/8/83/Create_translations_mac_10.6.zip create_translations tool for Mac OS X Snow Leopard]
Line 36: Line 38:
  ./create_translations *.po
  ./create_translations *.po


For Windows you can simply run the included bat file.
If you have codepages present in po - which enable other charsets from languages, you will also need to include it as a command-line argument, along with *.po, like this:
./create_translations *.po *.cp
 
For Windows, you can simply run the included bat file.


This will generate a translations.dat file that you need to place in your ScummVM Theme path.
This will generate a translations.dat file that you need to place in your ScummVM Theme path.
TrustedUser
2,147

edits

Navigation menu