Difference between revisions of "Translation for developers"

Jump to navigation Jump to search
no edit summary
m (typos found with languagetool.org)
Line 5: Line 5:


<translate><!--T:2-->
<translate><!--T:2-->
This synchronization with Translatewiki needs three types of operation:
This synchronization with Translatewiki needs three types of operations:
* ''Add a string'' to Kiwix and Translatewiki, ie. introducing a dynamic string which will be replaced by the corresponding translation at the runtime.
* ''Add a string'' to Kiwix and Translatewiki, ie. introducing a dynamic string which will be replaced by the corresponding translation at the runtime.
* ''Update the Kiwix strings'' with the translations coming from Translatewiki.
* ''Update the Kiwix strings'' with the translations coming from Translatewiki.
Line 12: Line 12:


<translate>== Requirements == <!--T:3-->
<translate>== Requirements == <!--T:3-->
You need a GNU/Linux Operating System. This is possible to do also that on other operation systems, but this is more complicated to get a working environment.
You need a GNU/Linux Operating System. It is possible to do it in another operating system, but it is more complicated to get a working environment.
</translate>
</translate>


Line 18: Line 18:
You need to have a few things in mind:
You need to have a few things in mind:
* Kiwix translation files are all in the "kiwix/chrome/locale" directory.
* Kiwix translation files are all in the "kiwix/chrome/locale" directory.
* There is two types of translation files to translate the User Interface (Have a look to the *.js and *.xul file in kiwix/chrome/content/main to understand how it works):
* There are two types of translation files to translate the User Interface (Have a look at the *.js and *.xul files in kiwix/chrome/content/main to understand how it works):
** "main.dtd" which provides translations for all *.xul files
** "main.dtd" which provides translations for all *.xul files
** "main.properties" which provides translations for all *.js files.
** "main.properties" which provides translations for all *.js files.
* Translatewiki translations are imported separately in the Kiwix code repository on time a week and we always need to synchronize thus files with Kiwix code in both direction (KW->TW and TW -> KW).
* Translatewiki translations are imported separately in the Kiwix code repository once a week and we always need to synchronize those files with Kiwix code in both directions (KW->TW and TW -> KW).
</translate>
</translate>


Line 39: Line 39:


<translate><!--T:8-->
<translate><!--T:8-->
''Remark: If you are not able to compile Kiwix, or do not have xulrunner available (is the case for example on Ubuntu Oneiric and further) you will still be able to be able to start kiwix and get an interface although the application won't work correctly, but that's enough for example to manipulate the XUL files. In this case you will have to make a few additional stuff like add "MaxVersion=42.*" as new line to kiwix/application.ini and launch Kiwix using this command in the "kiwix" directory "firefox -app application.ini"''.
''Remark: If you are not able to compile Kiwix, or do not have xulrunner available (is the case for example on Ubuntu Oneiric and further) you will still be able to start kiwix and get an interface although the application won't work correctly, but that's enough for example to manipulate the XUL files. In this case you will have to make a few additional steps like add "MaxVersion=42.*" as new line to kiwix/application.ini and launch Kiwix using this command in the "kiwix" directory "firefox -app application.ini"''.
</translate>
</translate>


Line 53: Line 53:


<translate><!--T:12-->
<translate><!--T:12-->
If you find one you need to find a string identifier (foobar for example), have a look to the already localized string to see how it should looks like. the most important to know is that in the *.xul files, it should looks like "&foobar;" and in the *.js like "getProperty('foobar')".
If you find one you need to find a string identifier (foobar for example), have a look to the already localized string to see how it should look like. The most important to know is that in the *.xul files, it should look like "&foobar;" and in the *.js like "getProperty('foobar')".
</translate>
</translate>


Line 60: Line 60:


<translate><!--T:14-->
<translate><!--T:14-->
You will need to do that on two place. First in the "kiwix/chrome/locale/en/main/" main.dtd or main.properties files. In that way the Kiwix application knows what to display if the user interface language is English.
You will need to do that on two places. First in the "kiwix/chrome/locale/en/main/" main.dtd or main.properties files. In that way the Kiwix application knows what to display if the user interface language is English.
</translate>
</translate>


Line 86: Line 86:


<translate><!--T:20-->
<translate><!--T:20-->
The last thing you need to do is creating stub translation of your new localized string for all supported user interface languages in Kiwix. If you do not that, Kiwix won't be able to work correctly in another language as English.
The last thing you need to do is creating stub translation of your new localized string for all supported user interface languages in Kiwix. If you don't do that, Kiwix won't be able to work correctly in a language other than English.
</translate>
</translate>


<translate><!--T:21-->
<translate><!--T:21-->
For that purpose you need to use the script TW2PL.pl (this is a perl script, so perl needs to be installed) like following (go in the translatewiki file directory):
For that purpose you need to use the TW2PL.pl script (this is a perl script, so perl needs to be installed) like following (go in the translatewiki file directory):
</translate>
</translate>


Line 98: Line 98:


<translate>=== Commit the new Kiwix translation files === <!--T:22-->
<translate>=== Commit the new Kiwix translation files === <!--T:22-->
Now, all the locale file in kiwix/chrome/locale should be update and you should have a lot of (modified) files listed by typing:
Now, all the locale file in kiwix/chrome/locale should be updated and you should have a lot of (modified) files listed by typing:
</translate>
</translate>


Line 113: Line 113:


<translate><!--T:25-->
<translate><!--T:25-->
Another task is to update already supported Kiwix languages with the last strings updated coming from Translatewiki. The first thing to know about that is that in the remote subversion repository, the Translatewiki file (in maintenance/translatewiki) are each two weeks updated from a Translatewiki contributors. That means, you only need to update your local repository and update and commit the kiwix code translation files like following:
Another task is to update already supported Kiwix languages with the last strings updated coming from Translatewiki. The first thing to know about that is that in the remote subversion repository, the Translatewiki file (in maintenance/translatewiki) is updated every two weeks from a Translatewiki contributors. That means, you only need to update your local repository and update and commit the kiwix code translation files like this:
</translate>
</translate>


Line 130: Line 130:


<translate><!--T:28-->
<translate><!--T:28-->
Kiwix tries to add only 100% translated languages coming from Translatewiki. So it happens often that they are more languages in the "maintenance_tools/translatewiki" directory than in the "kiwix/kiwix/chrome/locale" directory. In such a case, that simply mean the Translatewiki language was still not integrated in Kiwix code base. We explain now how to do that.
Kiwix tries to add only 100% translated languages coming from Translatewiki. So it happens often that there are more languages in the "maintenance_tools/translatewiki" directory than in the "kiwix/kiwix/chrome/locale" directory. In such a case, that simply means the Translatewiki language was still not integrated in Kiwix code base. We explain now how to do that.
</translate>
</translate>


<translate><!--T:29-->
<translate><!--T:29-->
First of all you need to create the translation files in a new directory at "kiwix/kiwix/chrome/locale/your_language_iso_code" like following:
First of all you need to create the translation files in a new directory at "kiwix/kiwix/chrome/locale/your_language_iso_code" like this:
</translate>
</translate>


Line 142: Line 142:


<translate><!--T:30-->
<translate><!--T:30-->
After that you need go to the kiwix source code directory in "kiwix/chrome" and edit with your preferred text editor the "chrome.manifest" and "chrome.manifest.prod" files. No explanation here, just do like for the already supported languages.
After that, you need go to the Kiwix source code directory in "kiwix/chrome" and edit with your preferred text editor the "chrome.manifest" and "chrome.manifest.prod" files. No explanation here, just do like for the already supported languages.
</translate>
</translate>


Line 154: Line 154:


<translate><!--T:33-->
<translate><!--T:33-->
Add the new language directory and commit like following:
Add the new language directory and commit like this:
</translate>
</translate>


Navigation menu