Difference between revisions of "MG/Translations"

From MegaGlest
Jump to navigation Jump to search
(One intermediate revision by the same user not shown)
Line 20: Line 20:
 
Start by [https://www.transifex.com/signin/?next=/projects/p/megaglest/ signing up at Transifex] - that's a quick, one-time process. All accounts are free, you only pay when you host a commercial translation with them, but never as a translator. Do click on ''Sign up free''.
 
Start by [https://www.transifex.com/signin/?next=/projects/p/megaglest/ signing up at Transifex] - that's a quick, one-time process. All accounts are free, you only pay when you host a commercial translation with them, but never as a translator. Do click on ''Sign up free''.
  
Once you've entered your details, click on ''I am a translator'', then head over to the [https://www.transifex.com/projects/p/megaglest/ MegaGlest project on Transifex]. Over there, just click on the language you want to translate to. On the next screen, you select which ''resource'' to edit - these are the various language files there are in MegaGlest. Click on a resource to get a detail screen, then just push the ''Translate now'' button (or you could ''download for translation'' and ''upload'' it later). Only the first time you do this, you will need to review and accept the contributor license.
+
Once you've entered your details, click on ''I am a translator'', then head over to the [https://www.transifex.com/projects/p/megaglest/ MegaGlest project on Transifex]. Over there, just click on the language you want to translate to. On the next screen, you select which '''''resource''''' to edit - these are the various language files there are in MegaGlest. Click on a resource to get a detail screen, then just push the '''''Translate now''''' button. Only the first time you do this, you will need to review and accept the contributor license.
  
You can then start translating right away. On the left are the source strings, as they appear in the English language file. On the right is where you type your translation. Pretty simple, eh? There are some helpers to the left and right of each translation box. Give them a try, you will quickly find out what they are good for. Be sure to save your individual translations or, when you're done, click on the ''Save ...'' buttons on the very bottom of the page.
+
You can then start translating right away. On the left are the source strings, as they appear in the English language file. On the right is where you type your translation. Pretty simple, eh? There are some helpers to the left and right of each translation box. Give them a try, you will quickly find out what they are good for. Be sure to save your individual translations or, when you're done, click on the '''''Save...''''' buttons on the very bottom of the page.
  
By default, only those strings which are not yet translated will be shown. However, we also need you to confirm that existing translations are good so we can improve the overall quality of MegaGlests' translations. So once everything is translated for a language, untick the ''Reviewed'' box on top of the page, then verify that the existing translations are fine, too.
+
By default, only those strings which are not yet translated will be shown. However, we also need you to confirm that existing translations are good so we can improve the overall quality. So once everything is translated for a language, untick the '''''Reviewed''''' box on top of the page, then verify that the previously existing translations are fine, too.
  
Later, when the MegaGlest developers add new translation keys, they will automatically show up on Transifex, so translation is now a continuous work. Of course, translations still matter most for releases, so we'll keep notifying you on the [https://lists.sourceforge.net/lists/listinfo/megaglest-translations translation mailing list] when it's time to get translations into shape.
+
Later, when the MegaGlest developers add new translation keys, they will automatically show up on Transifex, so translation is now a continuous work. Of course, translations still matter most for releases, so we'll keep notifying you on the [https://lists.sourceforge.net/lists/listinfo/megaglest-translations translation mailing list] when it's time to get translations into shape. So be sure to subscribe, it makes [http://sourceforge.net/mailarchive/forum.php?forum_name=megaglest-translations really little traffic] .
  
  
 +
===Testing your translation===
 +
It is now very easy to test translations submitted to Transifex on your computer. All you need is to download the latest beta release (those usually come with an installer and we usually make those available some time before a stable release) or, better yet, the latest [http://megaglest.org/development.html nightly snapshot] (those come without an installer, but as two archives which you just need to unpack). If you are a developer, you could also [http://megaglest.org/development.html build MegaGlest yourself] .
  
===The old process (now deprecated)===
+
Once you have it, run it, then turn to the ''Options'' menu. Click the ''Advanced Translation'' button (in the top right corner). This enables some Transifex options at the bottom of the screen. Enter your Transifex '''''username''''', '''''password''''' and the [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes standard 2 character language code] for your translation. You should also be able to see this on Transifex while editing the translation: there should be a key saying ''ISO639-1'' with an English default string of ''en'' (on the left), with the translations' standard 2 character language code set on the right hand side. So, for example, if you are editing the German translation, this value would be ''de'' while for Chinese, it would be ''zh''.
<strike>To update an existing translation, you need to get the latest copy of the existing translation file, which is usually [http://megaglest.svn.sourceforge.net/viewvc/megaglest/trunk/data/glest_game/data/lang/?revision=HEAD the one in trunk], too.</strike>
 
  
<strike>For example, to update for example <tt>galician.lng</tt>, based on <tt>english.lng</tt>, you need to:</strike>
+
Once you entered this information, click the '''''Download''''' button to pull in your work from Transifex into MegaGlest for testing. Now do test, make corrections on the Transifex website, and repeat. Now be aware that these translations apply to all installed MegaGlest versions, and older versions you may have installed (such as the latest stable release) may not work well with the new translations you downloaded from Transifex. As such, when you're done testing, you should click the ''Delete language files'' button remove the files you pulled form Transifex. This way every version of MegaGlest will revert to its own original translations that existed before your changes.
* <strike>Make sure you use a text editor which supports Unix style line endings (such as every editor on Linux does and most editors on Windows — such as [http://notepad-plus-plus.org/ Notepad++]; Note that Microsoft's Notepad will '''not''' work) and the UTF-8 encoding.</strike>
+
 
* <strike>Remove any lines from <tt>galician.lng</tt> which contain keywords which are not contained in <tt>english.lng</tt>.</strike>
+
Note that the Transifex credentials you enter on the ''options'' screen will only last until you quit MegaGlest. You can also set these in [[INI|glestuser.ini]] as follows:
* <strike>Add any lines to <tt>galician.lng</tt> which contain keywords which are contained in <tt>english.lng</tt> (but have not been contained in <tt>galician.lng</tt> so far).</strike>
+
TranslationGetURLUser=MyTransifexUserName
* <strike>Replace the english translation strings by a galician translation. Try to use one which is not or just a little bit longer than the english string because the text will need to fit into a given place on screen.</strike>
+
TranslationGetURLPassword=MySecretPassword
* <strike>Save the file using UTF-8 character encoding. In case this option is provided, please do not store the byte-order mark (BOM).</strike>
+
TranslationGetURLLanguage=de
* <strike>Run the game with your new translations and see whether your new translations really make sense where they are used. It can easily happen that you add a translation which does not make sense in the given context. Also make sure that your translation really fits well on screen with the default font size. You may add <tt>\n</tt> (backslash and 'n') to your translation strings to wrap the text across multiple lines. But make sure what this does not break the looks either - you should test this at a 800x600 resolution.</strike>
+
Please be aware that '''storing your password in this file can be a security risk''', though. If you do, you must ensure that only you, not anyone else using your computer, or a different system user (apart of the administrative user), is able do read this file. On Linux, you would do so by running: chmod 600 ~/.megaglest/glestuser.ini
* <strike>Make a final check to verify it's all ok.</strike>
+
 
* <strike>Paste your new/updated translation on [http://paste.megaglest.org paste.megaglest.org] and paste the resulting internet address on the MegaGlest forums as a new translation. Alternatively, send the translation file to [http://megaglest.org/contact.html the MegaGlest general contact e-mail address] or one of the main developers (by e-mail). Please provide information on how you would like to be credited in the documentation for the next release - credit is usually recorded either by their first name, full name or nickname.</strike>
+
 
 +
===Adding new languages===
 +
To add support for an entirely new language to MegaGlest, or to add a resource which is not yet available for a given language, please contact the [http://megaglest.org/contact.html MegaGlest team] and state which languages and resources (all?) we should be adding. We'll add them swiftly.
  
 
== Translating techtrees==
 
== Translating techtrees==

Revision as of 03:35, 23 October 2012

Some of the existing translations are not very well maintained and, so far, only a couple languages are supported, so keeping files up to date or adding new translations helps the MegaGlest community a great deal.

How translations work

MegaGlest comes with several language files, a few for each supported language. These files always contain several lines which always take the same pattern:

KeyWord=This is some lengthy translation string.

These keywords, also dubbed 'translation keys', are referenced in the source code of the game. Depending on the language the user has chosen, when these keywords are met during execution of the game, the translation string which matches this keyword is taken from the language file and printed on screen.

The main game language is English, so when a developer adds a new translation key, s/he will also edit the english language variant of the corresponding translation file and place translation key and the English string in there.

The english variant of the main language file is called english.lng. The latest version of english.lng is the one in trunk. There could theoretically be newer ones in (other) branches of the subversion source code repository but that's unlikely and if this should ever happen the developers should be telling you.

How to provide translations

MegaGlest's translations are now managed on Transifex, a website allowing for easy translation of a software such as MegaGlest, all from within your web browser.


Getting started

Start by signing up at Transifex - that's a quick, one-time process. All accounts are free, you only pay when you host a commercial translation with them, but never as a translator. Do click on Sign up free.

Once you've entered your details, click on I am a translator, then head over to the MegaGlest project on Transifex. Over there, just click on the language you want to translate to. On the next screen, you select which resource to edit - these are the various language files there are in MegaGlest. Click on a resource to get a detail screen, then just push the Translate now button. Only the first time you do this, you will need to review and accept the contributor license.

You can then start translating right away. On the left are the source strings, as they appear in the English language file. On the right is where you type your translation. Pretty simple, eh? There are some helpers to the left and right of each translation box. Give them a try, you will quickly find out what they are good for. Be sure to save your individual translations or, when you're done, click on the Save... buttons on the very bottom of the page.

By default, only those strings which are not yet translated will be shown. However, we also need you to confirm that existing translations are good so we can improve the overall quality. So once everything is translated for a language, untick the Reviewed box on top of the page, then verify that the previously existing translations are fine, too.

Later, when the MegaGlest developers add new translation keys, they will automatically show up on Transifex, so translation is now a continuous work. Of course, translations still matter most for releases, so we'll keep notifying you on the translation mailing list when it's time to get translations into shape. So be sure to subscribe, it makes really little traffic .


Testing your translation

It is now very easy to test translations submitted to Transifex on your computer. All you need is to download the latest beta release (those usually come with an installer and we usually make those available some time before a stable release) or, better yet, the latest nightly snapshot (those come without an installer, but as two archives which you just need to unpack). If you are a developer, you could also build MegaGlest yourself .

Once you have it, run it, then turn to the Options menu. Click the Advanced Translation button (in the top right corner). This enables some Transifex options at the bottom of the screen. Enter your Transifex username, password and the standard 2 character language code for your translation. You should also be able to see this on Transifex while editing the translation: there should be a key saying ISO639-1 with an English default string of en (on the left), with the translations' standard 2 character language code set on the right hand side. So, for example, if you are editing the German translation, this value would be de while for Chinese, it would be zh.

Once you entered this information, click the Download button to pull in your work from Transifex into MegaGlest for testing. Now do test, make corrections on the Transifex website, and repeat. Now be aware that these translations apply to all installed MegaGlest versions, and older versions you may have installed (such as the latest stable release) may not work well with the new translations you downloaded from Transifex. As such, when you're done testing, you should click the Delete language files button remove the files you pulled form Transifex. This way every version of MegaGlest will revert to its own original translations that existed before your changes.

Note that the Transifex credentials you enter on the options screen will only last until you quit MegaGlest. You can also set these in glestuser.ini as follows:

TranslationGetURLUser=MyTransifexUserName
TranslationGetURLPassword=MySecretPassword
TranslationGetURLLanguage=de

Please be aware that storing your password in this file can be a security risk, though. If you do, you must ensure that only you, not anyone else using your computer, or a different system user (apart of the administrative user), is able do read this file. On Linux, you would do so by running: chmod 600 ~/.megaglest/glestuser.ini


Adding new languages

To add support for an entirely new language to MegaGlest, or to add a resource which is not yet available for a given language, please contact the MegaGlest team and state which languages and resources (all?) we should be adding. We'll add them swiftly.

Translating techtrees

Please note: Techtree translations for the Megapack (MegaGlest's default techtree) are not currently accepted. You are welcome to translate any other techtrees, though.

Some techtree related information which displays in the graphical user interface, such as unit or structure names or unit/attack properties, can now (starting r3285) be translated, too. Here is how it works:

  • For a given techtree (lets assume Megapack) create a subdirectory named lang within the megapack (techtree) directory, i.e. techtrees/megapack/lang/ (skip if it already exists)
  • In this new directory, create a new language file using this naming convention (skip if it already exists):
    techtree_language.lng.
    Example: megapack_german.lng
  • Edit the file. Supported translatable items are currently: resource, unit and upgrade names. So In each language file add:
    ResourceTypeName_food=Yummies
    UnitTypeName_archer=Stealth Minion
    UpgradeTypeName_advanced_architecture=Fancy Science
    Here, food, archer and advanced_architecture are examples. You need to use the keywords this very techtree defines there. In game the discovered translated strings will display if the user is using a supported language, otherwise it defaults to original behavior.

Keep your translation up to date

After you completed your translation, please make sure you also subscribe to the megaglest-translations mailing list. This mailing list is used to notify translators that we will soon release a new version, so they have a chance to ensure that their translation is complete. Note that during development it will happen that new translation keys are added, and possibly old ones removed, so it is very likely that changes need to be made to existing translations to make them complete for the next release.

See Also