Difference between revisions of "Development:Translations:FrenchWorkTree"

From VsWiki
Jump to: navigation, search
m (Progress: moved "communications")
m (Progress)
 
(6 intermediate revisions by the same user not shown)
Line 31: Line 31:
  
 
[[Development:Translations:FrenchWorkTree:Notes | Notes on translatable texts in diffrent files formats]]
 
[[Development:Translations:FrenchWorkTree:Notes | Notes on translatable texts in diffrent files formats]]
 +
 +
== Import gettext module ==
 +
Presuming all gettext files are available in the Vega Strike package, a line must be added at the beginning of each module containing translatable text, to import the gettext module.<br/>
 +
''Python'' : import gettext<br/>
 +
''C++'' : #include <libintl.h>
  
 
== Generate the .po file from the source code, with PoEdit ==
 
== Generate the .po file from the source code, with PoEdit ==
Line 42: Line 47:
 
Please add here the tree which has been processed. If an entire folder is processed, please don't show all files list, a (*) near the folder name will be enough ;-)
 
Please add here the tree which has been processed. If an entire folder is processed, please don't show all files list, a (*) near the folder name will be enough ;-)
 
   data
 
   data
   |---bases (*) (green)
+
   |---bases (*) (green) .py
   |  |---fixers (*) (Obu)
+
   |  |---fixers (*) (Obu) .py
   |---communications (en cours) (Obu)
+
   |---communications (canceled) (Obu) .xml gettext works with c++ and python files. We'll make it work with these formats, then try with XML.
   |---mission (*) I had to re-factor all the .mission for poedit to detect translatable text (costalfy)
+
   |---mission (*) I had to re-factor all the .mission for poedit to detect translatable text (costalfy) .mission
   |---modules (*) (green)
+
                      ex : <var name="mission_name" value="Bounty Mission" />  =>  <var name="mission_name">Bounty Mission</var>
   |  |-------- quests (*) ( ezee )
+
   |---modules (*) (green) .py
 +
  |  |-------- ai (green) no texts
 +
  |  |-------- missions (green) .py
 +
   |  |-------- quests (*) ( ezee ) .py
 +
 
 +
Nota : for all these directories (except "communications"), "import gettext" and "_()" tags were added in files in need.

Latest revision as of 21:57, 11 April 2016

View this site in other languages:   DeutschEnglishFrançaisEspañolPolskiItalianoNederlandsРуccкий简体中文


Creation

A new repository has been created on github https://github.com/costalfy/Vega-Strike. It holds in the sourceforge's trunk's data folder dated 13/04/2014 (r13675).

I had to delete following files in order to not exceed my quota.

  • *.bmp
  • *.psd
  • *.jpg
  • *.png
  • *.ogg
  • *.texture
  • *.image
  • *.bfxm
  • /textures

I've created a new folder i18n/LC_MESSAGES, which will contain files to traduce
Some indications for the Github repository use are proposed here: Github

Process

Please read carefully the doc about how to work with github and comments on what must be translated in the source code.

Add gettext tags in the source code

Adding internationalization in python or c++ code is fairly simple. You have to scan the source code, and spot the hardcoded english text. Then, for each text, you have to coat it in a gettext tag _(...) like this :

 Base.Message("No? Come back to me again if you change your mind.")
 becomes :
 Base.Message(_("No? Come back to me again if you change your mind."))

Some exemples are already on the repository https://github.com/costalfy/Vega-Strike/commit/9cf2078c3fc39681404e59512b2a86503b49f887

Notes on translatable texts in diffrent files formats

Import gettext module

Presuming all gettext files are available in the Vega Strike package, a line must be added at the beginning of each module containing translatable text, to import the gettext module.
Python : import gettext
C++ : #include <libintl.h>

Generate the .po file from the source code, with PoEdit

When all the source code will have been scanned, we'll use this software PoEdit, to scan the source code and locate all added tags : _(...). The software will create the vegastrike-fr_FR.po file, which will contain all translatable texts... magic :)

Translate the .po with PoEdit

Translators will use the same software to open the /data/i18n/LC_MESSAGES/vegastrike-fr_FR.po file, and will have to translate each line... This is less magic ;-)

Progress

Please add here the tree which has been processed. If an entire folder is processed, please don't show all files list, a (*) near the folder name will be enough ;-)

 data
 |---bases (*) (green) .py
 |   |---fixers (*) (Obu) .py
 |---communications (canceled) (Obu) .xml gettext works with c++ and python files. We'll make it work with these formats, then try with XML.
 |---mission (*) I had to re-factor all the .mission for poedit to detect translatable text (costalfy) .mission
                     ex : <var name="mission_name" value="Bounty Mission" />   =>   Bounty Mission
 |---modules (*) (green) .py
 |   |-------- ai (green) no texts
 |   |-------- missions (green) .py
 |   |-------- quests (*) ( ezee ) .py

Nota : for all these directories (except "communications"), "import gettext" and "_()" tags were added in files in need.