Traduzione per sviluppatori

From Kiwix
Revision as of 21:54, 15 January 2015 by Macofe (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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).

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

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.

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

git pull origin master

Ora hai sul tuo computer le traduzioni di Translatewiki. Ciò che ti serve e solo aggiornare il file "en" la quale è il file della lingua principale per Translatewiki. Quindi aggiungi la nuova stringa seguendo l'esemio degli altri che l'hanno già fatto e spedisci il tuo file "en".

Qualcuno da Translatewiki controlla settimanalmente il file "en" in cerca di nuove stringhe e se necessario sincronizza Transatewiki con questo file.

Crea una bozza di traduzione della tua nuova stringa per tutte le lingue

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 TW2PL.pl script (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 updated and you should have a lot of (modified) files listed by typing:

git status kiwix/chrome/locale

Dopo aver verificato che tutto sia corretto, puoi spedire le tue modifiche, cioè la cartella kiwix/chrome/locale e i file *xul e *js che hai modificato.

Aggiorna le traduzioni di 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:

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

Il percorso completo dovrebbe essere la cartella moulinkiwix, non la cartella kiwix che contiene.

Aggiungi a Kiwix il supporto ad una nuova lingua

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

./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 preferred text editor the "chrome.manifest" and "chrome.manifest.prod" files. No explanation here, just do like for the already supported languages.

Successivamente modifica "chrome/content/main/js/language.js" e aggiungi anche qui la nuova lingua.

Ora aggiorna CHANGELOG e crea una notifica dell'aggiunta della nuova lingua supportata.

Add the new language directory and commit like this:

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