4,304
edits
(translatewiki ファイルの更新) |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{translations}} | {{translations}} | ||
Beside the pure [[translation]] part of the work, the '''Kiwix source code needs to be synchronized with Translatewiki'''. | Beside the pure [[{{ll|translation}}]] part of the work, the '''Kiwix source code needs to be synchronized with Translatewiki'''. | ||
This | 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. | ||
* ''Add a new Translatewiki full translated language to Kiwix''. | * ''Add a new Translatewiki full translated language to Kiwix''. | ||
GNU/Linux | == Requirements == | ||
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. | |||
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 | * 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 | * 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). | ||
''' | '''警告: Kiwix のソースコードを編集する前に、ローカル コード リポジトリのそれぞれで "git pull origin master" を実行してリポジトリを更新してください。''' | ||
== コードのチェックアウトとKiwixの開始 == | == コードのチェックアウトとKiwixの開始 == | ||
Before starting to work on the integration of new strings in the Kiwix code, it's preferable to [[compilation|achieve to compile Kiwix]]: | Before starting to work on the integration of new strings in the Kiwix code, it's preferable to [[{{ll|compilation}}|achieve to compile Kiwix]]: | ||
* Get the unstable code | * Get the unstable code | ||
* Compile it | * Compile it | ||
* Run it by going to the kiwix subdirectory and launching ''kiwix''. | * Run it by going to the kiwix subdirectory and launching ''kiwix''. | ||
''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 | ''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"''. | ||
== 翻訳への文字列の追加 == | == 翻訳への文字列の追加 == | ||
Line 33: | Line 34: | ||
Go through the *.xul and *.js files to find hardcoded strings (in English). | Go through the *.xul and *.js files to find hardcoded strings (in English). | ||
If you find one you need to find a string identifier (foobar for example), have a look to the already | 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 it in the master language English === | === Translate it in the master language English === | ||
You will need to do that on two | 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. | ||
=== | === translatewikiファイルの更新 === | ||
But you also need to tell Translatewiki to add this string in the list of string it has to provide (for the Translatewiki translators) to translate. For that you need to checkout | But you also need to tell Translatewiki to add this string in the list of string it has to provide (for the Translatewiki translators) to translate. For that you need to checkout another part of Kiwix code repository. Please run outside of your local kiwix code directory following console command: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 51: | Line 52: | ||
Someone from Translatewiki check each week the "en" file for new strings and synchronized Translatewiki with this file if necessary. | Someone from Translatewiki check each week the "en" file for new strings and synchronized Translatewiki with this file if necessary. | ||
=== | === すべての言語について新しい文字列のスタブ翻訳を作成 === | ||
The last thing you need to do is creating stub translation of your new | 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. | ||
For that purpose you need to use the | 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): | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 62: | Line 63: | ||
=== Commit the new Kiwix translation files === | === Commit the new Kiwix translation files === | ||
Now, all the locale file in kiwix/chrome/locale should be | Now, all the locale file in kiwix/chrome/locale should be updated and you should have a lot of (modified) files listed by typing: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 70: | Line 71: | ||
After checking everything is OK, you can commit your modifications: ie. the kiwix/chrome/locale directory and the *.xul and/or *.js files you have modified. | After checking everything is OK, you can commit your modifications: ie. the kiwix/chrome/locale directory and the *.xul and/or *.js files you have modified. | ||
== | == Kiwixの翻訳の更新 == | ||
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: | |||
<source lang="bash"> | <source lang="bash"> | ||
Line 82: | Line 83: | ||
The full path should be the moulinkiwix directory, not the kiwix directory in it. | The full path should be the moulinkiwix directory, not the kiwix directory in it. | ||
== | == Kiwixへの新たな対応言語の追加 == | ||
Kiwix tries to add only 100% translated languages coming from Translatewiki. So it happens often 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. | ||
First of all you need to create the translation files in a new directory at "kiwix/kiwix/chrome/locale/your_language_iso_code" like | 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: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 92: | Line 93: | ||
</source> | </source> | ||
After that you need go to the | 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. | ||
Next edit chrome/content/main/js/languages.js and here also add the new languages. | Next edit chrome/content/main/js/languages.js and here also add the new languages. | ||
Line 98: | Line 99: | ||
Now update CHANGELOG and make a notice about the addition of the new supported languages. | Now update CHANGELOG and make a notice about the addition of the new supported languages. | ||
Add the new language directory and commit like | Add the new language directory and commit like this: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 106: | Line 107: | ||
</source> | </source> | ||
== | == 関連項目 == | ||
* [[Translation]] | * [[{{ll|Translation}}|翻訳]] | ||
* [[Compilation]] | * [[{{ll|Compilation}}|コンパイル]] | ||
[[Category:Developer's Guide]] | [[Category:Developer's Guide]] |