Editing MG/Translations

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
 
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.
 
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.
  
==Providing translations as a volunteer==
+
==How translations work==
MegaGlest's translations are managed on [http://transifex.com Transifex], a website allowing for easy software translation from within your web browser.
+
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 <tt>english.lng</tt>. The latest version of <tt>english.lng</tt> is [http://megaglest.svn.sourceforge.net/viewvc/megaglest/trunk/data/glest_game/data/lang/english.lng?revision=HEAD the one in trunk]. There could theoretically be newer ones in (other) [http://megaglest.svn.sourceforge.net/viewvc/megaglest/branches/ 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 [http://transifex.com Transifex], a website allowing for easy translation of a software such as MegaGlest, all from within your web browser.
  
 
===Getting started===
 
===Getting started===
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 would only need to pay when you order an account upgrade or professional services (and you would actually have to opt-in to this, providing payment details etc.), but never as a translator. So just 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. 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.
Line 15: Line 26:
 
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] .
 
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] .
 
===Adding new languages===
 
===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 review our [[MG/Translations/Processing translations|translation policies]], then request the new translation on Transifex. Should you not hear back within two days, please [http://megaglest.org/contact.html contact the MegaGlest team] and state which languages we should add for you to work on. We'll add them swiftly. Please do not ask us to add a translation unless you are actually willing to start contributing to it within a few days.
+
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.
  
 
==Testing your translation==
 
==Testing your translation==
Line 28: Line 39:
 
  TranslationGetURLPassword=MySecretPassword
 
  TranslationGetURLPassword=MySecretPassword
 
  TranslationGetURLLanguage=de
 
  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
+
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  
 
'''Hint:''' To switch between translations anytime while running MegaGlest, just press '''''Ctrl-L'''''. This will show a pop-up menu where you can select the new language. As you click, the change applies immediately.
 
'''Hint:''' To switch between translations anytime while running MegaGlest, just press '''''Ctrl-L'''''. This will show a pop-up menu where you can select the new language. As you click, the change applies immediately.
  
==How translations work under the hood==
+
== Translating techtrees==
MegaGlest comes with several language files, a few for each supported language. These files always contain several lines which always take the same pattern:
+
It is now possible (starting 3.8.0-dev+r3285) to translate all techtree related strings such as unit or structure titles and unit/attack properties which display on the graphical user interface.
 +
===Translation of distributed techtrees===
 +
 
 +
Techtrees which are distributed and installed with MegaGlest - that's currently the ''Megapack'' only - can and should be translated by editing the [https://www.transifex.com/projects/p/megaglest/resource/megapack/ Megapack resource on Transifex] . Should there be more techtrees distributed with MegaGlest in the future, they will be added as separate resources on Transifex. Should we forget to do so, please bring it up on the translation mailing list (see below).
 +
===Translation of non-distributed techtrees===
 +
 
 +
Techtrees ''not'' distributed with MegaGlest ''may'' need to be localized manually - please check with the techtrees' authors as to whether they have a more translator friendly approach in place. This article is limited to describing the manual process.
 +
====Initialization====
 +
First of all, a techtree needs to be prepared for localization. This only needs to be done the first time a techtree is localized, or when units / structures / resources / upgrades have changed in the techtree's XML files.
  
  KeyWord=This is some lengthy translation string.
+
This process creates / updates the (English) source language files containing all techtree related translation keys, based on values found in the techtrees' (already existing) XML files. To do the initialization for an example techtree ''MyTechtree'' whose main XML file is ''mytechtree.xml'', change into the directory MegaGlest is installed in and run the executable binary file as follows (again replace ''mytechtree'' by the name of your techtree):
 +
=====Linux, OS X=====
 +
  ./megaglest --translate-techtrees=mytechtree
 +
=====Windows=====
 +
megaglest.exe --translate-techtrees=mytechtree
 +
====Editing====
  
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.
+
Once initialized, the techtree can be localized by manually editing the files:
  
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 both the translation key and the English string in there.
+
* For a given techtree ''MyTechtree'' create a subdirectory named ''lang'' within the ''mytechtree'' (techtree) directory, i.e. <tt>techs/''mytechtree''/lang/</tt> - if this directory does not exist then this techtree has not been initialized for localization, yet.
  
The English variant of the main language file is called <tt>english.lng</tt>. The latest version of <tt>english.lng</tt> is [http://megaglest.svn.sourceforge.net/viewvc/megaglest/trunk/data/glest_game/data/lang/english.lng?revision=HEAD the one in trunk]. There could theoretically be newer ones in (other) [http://megaglest.svn.sourceforge.net/viewvc/megaglest/branches/ branches] of the subversion source code repository but that's unlikely and if this should ever happen the developers should be telling you.
+
* In this new directory, create a new create a new copy of the source translation file  <tt>''mytechtree''_english.lng</tt> as <tt>''mytechtree''_''language''.lng</tt> where ''language'' is the localization you wish to create (skip this step if the target file already exists). Have a look at how it's done for Megapack if you'd like to get a better idea of what the file / directory structure should look like.
  
== Translating techtrees==
+
* Edit the newly created file <tt>''mytechtree''_''language''.lng</tt>. You will notice that there are several keys in this format:
Please refer to the separate page on [[MG/Translations/Techtrees|translating techtrees]].
+
** <tt>ResourceTypeName_''food''=Yummies</tt>
[[Category:MG]]
+
** <tt>UnitTypeName_''archer''=Stealth Minion</tt>
[[Category:Translations]]
+
** <tt>UpgradeTypeName_''advanced_architecture''=Fancy Science</tt><br />
 +
:: Here, ''food'', ''archer'' and ''advanced_architecture'' are examples. You need to use the keywords this very techtree defines there. At runtime, the game will display any localized resource, unit, structure, upgrade, ... titles available on those localization files (make sure you have not misspelled the keys and target language / file name - check against those in Megapack). If no mathcing localizations are found or for the currently selected language there is no techtree localization, yet, the game will defaults to the source language strings.
 +
==== Related forum discussions====
 +
* [https://forum.megaglest.org/index.php?topic=8845 Support for 100% translation]
 +
* [https://forum.megaglest.org/index.php?topic=8292 Translatable techtrees]
  
 
== Keep yourself in the loop==
 
== Keep yourself in the loop==

Please note that all contributions to MegaGlest are considered to be released under the Creative Commons Attribution Share Alike (see MegaGlest:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)