Difference between revisions of "Translation for developers/it"

From Kiwix
Jump to navigation Jump to search
(Updating to match new version of source page)
Line 2: Line 2:
Parallelamente alla pura [[translation/it|traduzione]], il '''codice sorgente di Kiwix necessita di essere sincronizzato con Translatewiki'''.
Parallelamente alla pura [[translation/it|traduzione]], il '''codice sorgente di Kiwix necessita di essere sincronizzato con Translatewiki'''.


This synchronization with Translatewiki needs three types of operations:
La sincronizzazione con Translatewiki consta di tre tipi di operazioni:
* ''Add a string'' to Kiwix and Translatewiki, ie. introducing a dynamic string which will be replaced by the corresponding translation at the runtime.
*''Aggiungere una stringa'' a Kiwix e Translatewiki, per esempio introducenso una stringa dinamica che verrà rimpiazzata dalla traduzione corrispondente in fase di esecuzione.
* ''Update the Kiwix strings'' with the translations coming from Translatewiki.
*''Aggiornare le stringhe di Kiwix'' con le traduzioni prese da Translatewiki.
* ''Add a new Translatewiki full translated language to Kiwix''.
*''Aggiungere il supporto a Kiwix per una nuova lingua su Translatewiki''.


==Requisiti==
== Requirements ==
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.
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:
Line 26: Line 26:
*Avvialo andando nella sottocartella kiwix e eseguendo "kiwix".
*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"''.
''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"''.


== Aggiungi una stringa alle traduzioni ==
== Aggiungi una stringa alle traduzioni ==
Line 34: Line 34:
Naviga tra i file *.xul e *.js per trovare stringhe con codice (in inglese).
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')".
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 ===


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.
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 ===
=== Aggiorna i file Translatewiki ===


Devi anche dire a Translatewiki di aggiungere questa stringa alla lista delle stringhe da far tradurre (per i traduttori di Translatewiki). Per questo devi verificare un'altra parte del repository di Kiwix. Per favore esci dal tuo repository locale di Kiwix col comando:
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 54: Line 54:
=== Crea una bozza di traduzione della tua nuova stringa per tutte le lingue ===
=== Crea una bozza di traduzione della tua nuova stringa per tutte le lingue ===


L'ultima cosa che devi fare è creare una bozza di traduzione della tua nuova stringa per tutte le lingue dell'interfaccia utente di Kiwix. Se non lo fai Kiwix non funzionerà correttamente in una lingua diversa dall'inglese.
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.


A questo proposito devi usare lo script TW2PL.pl (è uno script in perl, perciò devi aver installato perl) come segue (va nella cartella dei file di Translatewiki):
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 62:
</source>
</source>


=== Spedisci i nuovi file di traduzione di Kiwix ===
=== 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:


<source lang="bash">
<source lang="bash">
Line 72: Line 73:
== Aggiorna le traduzioni di Kiwix ==
== Aggiorna le traduzioni di Kiwix ==


Un'altra attività è aggiornare lingue già supportate da Kiwix con le ultime stringhe provenienti da Translatewiki. La prima cosa da sapere è che nel repository remoto i file di Translatewiki (in maintenance/translatewiki) sono aggiornati ogni due settimane dai contributori di Translatewiki. Ciò significa che devi solo aggiornare il tuo repository locale e aggiornare e spedire le traduzioni del codice di Kiwix come segue:
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 84: Line 85:
== Aggiungi a Kiwix il supporto ad una nuova lingua ==
== Aggiungi a Kiwix il supporto ad una nuova lingua ==


Kiwix prova ad aggiungere solo le lingue tradotte al 100% da Translatewiki. Così succede spesso che ci sono più lingue nella cartella "maintenance_tools/translatewiki" che nella cartella "kiwix/kiwix/chrome/locale". In questo caso significa semplicemente che la lingua di Translatewiki non era ancora integrata nel codice base di Kiwix. Spieghiamo ora come fare.
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.


Prima di tutto devi creare i file di traduzione in una nuova cartella del tipo "kiwix/kiwix/locale/codice_iso_della_tua_lingua" come segue:
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">

Revision as of 21:52, 15 January 2015

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.

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:

  • Kiwix translation files are all in the "kiwix/chrome/locale" directory.
  • 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.properties" which provides translations for all *.js files.
  • 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).

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".

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".

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