Difference between revisions of "Translation for developers/it"

From Kiwix
Jump to navigation Jump to search
(Created page with "Avrai bisogno di farlo in due posti. Prima nel main.dtd o nel file main.properties di "kiwix/chrome/locale/en/main/". In questo modo l'applicazione Kiwix sa cosa mostrare se l...")
(Created page with "=== Aggiorna i file Translatewiki ===")
Line 40: Line 40:
Avrai bisogno di farlo in due posti. Prima nel main.dtd o nel file main.properties di "kiwix/chrome/locale/en/main/". In questo modo l'applicazione Kiwix sa cosa mostrare se l'interfaccia utente è in inglese.
Avrai bisogno di farlo in due posti. Prima nel main.dtd o nel file main.properties di "kiwix/chrome/locale/en/main/". In questo modo l'applicazione Kiwix sa cosa mostrare se l'interfaccia utente è in inglese.


=== Update Translatewiki files ===
=== Aggiorna i file 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 an other part of Kiwix code repository. Please run outside of your local kiwix code directory following console command:
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 an other part of Kiwix code repository. Please run outside of your local kiwix code directory following console command:

Revision as of 11:13, 7 November 2014

Other languages:
Bahasa Melayu • ‎English • ‎català • ‎español • ‎français • ‎galego • ‎italiano • ‎magyar • ‎português • ‎русский • ‎日本語

Parallelamente alla pura traduzione, il codice sorgente di Kiwix necessita di essere sincronizzato con Translatewiki.

La sincronizzazione con Translatewiki consta di tre tipi di operazioni:

  • Aggiungere una stringa a Kiwix e Translatewiki, per esempio introducenso una stringa dinamica che verrà rimpiazzata dalla traduzione corrispondente in fase di esecuzione.
  • Aggiornare le stringhe di Kiwix con le traduzioni prese da Translatewiki.
  • Aggiungere il supporto a Kiwix per una nuova lingua su Translatewiki.

Requisiti

Hai bisogno di un sistema operativo GNU/Linux. É possibile fare lo stesso con un altro sistema operativo, ma sarebbe più complicato creare un ambiente di lavoro.

Devi tenere a mente alcune cose:

  • I file di traduzione diKiwix sono tutti nella cartella "kiwix/chrome/locale".
  • Ci sono 2 tipi di file di traduzione per tradurre l'Interfaccia Utente (Dà un'occhiata ai file *.js e *.xul in kiwix/chrome/content/main per capire come funziona):
    • "main.dtd" che fornisce traduzioni per tutti i file *.xul;
    • "main.properties" che fornisce traduzioni per tutti i file *.js.
  • Le traduzioni da Translatewiki sono importate separatamente nel repository del codice di Kiwix nel giro di una settimana e perciò abbiamo sempre bisogno di sincronizzare questi file col codice Kiwix in entrambe le direzioni (KW->TW e TW->KW).

ATTENZIONE: Prima di qualsiasi modifica del codice sorgente di Kiwix, aggiorna i tuoi repository locali con "git pull origin master" per ognuno di loro.

Verifica il codice e avvia Kiwix

Prima di iniziare a integrare nuove stringhe nel codice di Kiwix è preferibile compilare Kiwix:

  • Scarica il codice non stabile
  • Compilalo
  • Avvialo andando nella sottocartella kiwix e eseguendo "kiwix".

Nota: Se non sei capace di compilare Kiwix o non hai xulrunner (è il caso per esempio di Ubuntu Oneiric e successivi) sarai comunque in grado di avviare kiwix e avere un'interfaccia anche se l'applicazione non funziona correttamente, ma è sufficiente per manipolare file XUL. In questo caso dovrai fare operazioni aggiuntive come aggiungere la nuova riga "MaxVersion=42.*" in kiwix/application.ini e avviare Kiwix usando il comando "firefox-app application.ini" nella cartella "kiwix".

Aggiungi una stringa alle traduzioni

Cerca una stringa da tradurre

Naviga tra i file *.xul e *.js per trovare stringhe con codice (in inglese).

Se ne trovi una, cerca l'identificatore della stringa (ad esempio foobar), dà un'occhiata alle stringhe già tradotte per vedere come dovrebbe apparire. La cosa più importante da ricordare è che nei file *.xul dovrebbe apparire come "&foobar;" mentre nei file *.js come "getProperty('foobar')".

Translate it in the master language English

Avrai bisogno di farlo in due posti. Prima nel main.dtd o nel file main.properties di "kiwix/chrome/locale/en/main/". In questo modo l'applicazione Kiwix sa cosa mostrare se l'interfaccia utente è in inglese.

Aggiorna i file 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 an other part of Kiwix code repository. Please run outside of your local kiwix code directory following console command:

git pull origin master

You have now on your computer the translatewiki translations. What you need is only to update the "en" file which is the master language file for Translatewiki. So simply add your new string following the examples of other already inserted strings and commit your "en" file.

Someone from Translatewiki check each week the "en" file for new strings and synchronized Translatewiki with this file if necessary.

Create stub translation of you new string for all languages

The last thing you need to do is creating stub translation of your new localised 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.

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):

./TW2KW.pl --path=/full/path/to/the/kiwix/code/directory --allLanguages=kw

Commit the new Kiwix translation files

Now, all the locale file in kiwix/chrome/locale should be update and you should have a lot of (modified) files listed by typing:

git status kiwix/chrome/locale

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.

Update Kiwix translations

One other task is to update already supported Kiwix languages with the last string 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:

cd /full/path/to/the/kiwix/maintenance_tools/translatewiki
./TW2KW.pl --path=/full/path/to/the/kiwix/code/directory --allLanguages=kw
git commit /full/path/to/the/kiwix/code/directory/kiwix/chrome/locale
git push origin master

The full path should be the moulinkiwix directory, not the kiwix directory in it.

Add a new supported language to Kiwix

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 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 following:

./TW2KW.pl --path=/full/path/to/your/kiwix/code/base/directory/ --language=your_language_iso_code

After that you need go to the kiwix source code directory in "kiwix/chrome" and edit with your prefered 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.

Now update CHANGELOG and make a notice about the addition of the new supported languages.

Add the new language directory and commit like following:

git add kiwix/chrome/locale/language_iso_code
git commit CHANGELOG kiwix/chrome/chrome.manifest kiwix/chrome/chrome.manifest.prod kiwix/chrome/locale/ kiwix/chrome/content/main/js/gui.js
git push origin master

Vedi anche