Localisation/it: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
No edit summary
Line 27: Line 27:


{| class="mw-collapsible mw-collapsed wikitable"
{| class="mw-collapsible mw-collapsed wikitable"
|The following information doesn't need to be used anymore and will likely become obsolete.
|Le seguenti informazioni non devono più essere utilizzate ed è probabile che diventino obsolete.
Sono mantenute qui in modo che i programmatori possano conoscere come funziona.
It is being kept here so that programmers may familiarize themselves with how it works.
|-
|-
|
|
* Open all of the language folders of FreeCAD shown below
* Aprire tutte le cartelle di lingua di FreeCAD riportate in seguito
* Verify that a .ts file with your language code doesn't exist ("fr" for french, "de" for german, etc...)
* Verificare che non esista un file .ts file con il codice della lingua ("fr" per francese, "de" per tedesco, etc...)
* If it exists, you can download that file, if you want to modify/review/better the translation (click the file, then download)
* Se esiste, è possibile scaricare il file, se si vuole modificare / rivedere / megliorare la traduzione (fare clic sul file, quindi scaricare)
* Se non esiste, scaricare i file .ts senza il codice della lingua (o qualsiasi altro .ts disponibile, funzionerà ugualmente)
* If it doesn't exist, download the .ts file without language code (or any other .ts available, it will work too)
* Rinominare il file con il codice della propria lingua
* Rename that file with your language code
* Open it with the Qt-Linguist program
* Aprirlo con il programma Qt-Linguist
* Start translating (Qt Linguist is very easy to use)
* Iniziare la traduzione (Qt Linguist è molto semplice da usare)
* Once it's completely done, save your file
* Terminata la traduzione, salvare il file
* [http://www.freecadweb.org/tracker/main_page.php send the files to us] so we can include them in the freecad source code so they benefit other users too.<br />
* [http://www.freecadweb.org/tracker/main_page.php Inviare i file] in modo da poterli includere nel codice sorgente di FreeCAD e consentire l'utilizzo della traduzione anche ad altri utenti.<br />

''' Available translation files '''<br />
'''Archivio dei file di traduzione disponibili'''<br />

* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Gui/Language/ FreeCAD main GUI]
* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Gui/Language/ FreeCAD main GUI]
* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Complete/Gui/Resources/translations/ Complete Workbench]
* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Complete/Gui/Resources/translations/ Complete Workbench]
Line 171: Line 173:


{| class="mw-collapsible mw-collapsed wikitable"
{| class="mw-collapsible mw-collapsed wikitable"
|Queste istruzioni sono solo un background storico, mentre le pagine vengono passate al nuovo plugin di traduzione.
|These instructions are for historical background only, while the pages are being passed to the new translation plugin.
|-
|-
|
So the first step is to '''check if the manual translation has already been started for your language''' (look in the left sidebar, under "manual").<br />
If not, head to the [http://forum.freecadweb.org/ forum] and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.<br />
You must then [[FAQ#How_can_I_get_edit_permission_on_the_wiki.3F|gain wiki edit permission]].<br />
If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: '''go into a red page, and copy/paste the contents of the corresponding English page, and start translating'''.<br />
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use '''a slash and your language code''' in almost all the links. Look at other already translated pages to see how they did it.<br />
Add a slash and your language code in the categories, like <nowiki>[[Category:Developer Documentation/fr]]</nowiki> <br />
And if you are unsure, head to the forums and ask people to check what you did and tell you if it's right or not.<br />
Four templates are commonly used in manual pages. These 4 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)
* [[Template:GuiCommand]] : is the Gui Command information block in upper-right of command documentation.
* [[Template:Docnav]] : it is the navigation bar at the bottom of the pages, showing previous and next pages.
''' Page Naming Convention '''<br />
Please take note that, due to limitations in the Sourceforge implementation of the MediaWiki engine, we require that your pages all keep their original English counterpart's name, appending a slash and your language code. For example, the translated page for About FreeCAD should be About Freecad/es for Spanish, About FreeCAD/pl for polish, etc. The reason is simple: so that if translators go away, the wiki's administrators, who do not speak all languages, will know what these pages are for. This will facilitate maintenance and avoid lost pages.<br />
If you want the Docnav template to show linked pages in your language, you can use '''redirect pages'''. They are basically shortcut links to the actual page. Here is an example with the French page for About FreeCAD.<br />
* The page About FreeCAD/fr is the page with content
* The page À propos de FreeCAD contains this code:
#REDIRECT <nowiki>[[About FreeCAD/fr]]</nowiki>
* In the About FreeCAD/fr page, the Docnav code will look like this:
<nowiki>{{docnav/fr|Bienvenue sur l'aide en ligne|Fonctionnalités}}</nowiki>
The page "Bienvenue sur l'aide en ligne" redirects to Online Help Startpage/fr, and the page "Fonctionnalités" redirects to Feature list/fr.
|}
|}



Revision as of 20:00, 24 March 2015

Localizzazione è in generale il processo che fornisce un software con una interfaccia utente (GUI) multilingua.

In FreeCAD è possibile impostare la lingua dell'interfaccia utente in Modifica → Preferenze → Applicazione.

FreeCAD utilizza Qt per abilitare il supporto di più lingue. Sui sistemi Unix / Linux, FreeCAD utilizza le impostazioni locali di default del sistema.

Contribuire a tradurre FreeCAD

Una cosa importante che si può fare per FreeCAD, se non si è un programmatore, è quella di contribuire a tradurre il programma nella propria lingua.

Ora, con l'uso di Crowdin File:Crowdin.png, un sistema collaborativo di traduzione on line, contribuire è più facile che mai.

Come tradurre

  • Andare alla pagina Traduzione del progetto FreeCAD in Crowdin;
  • Accedere creando un nuovo profilo, o utilizzando un account di terze parti come il proprio indirizzo Gmail;
  • Fare clic sulla lingua su cui si desidera lavorare;
  • Iniziare a tradurre facendo clic sul pulsante Traduci accanto a uno dei file. Ad esempio, su FreeCAD.ts che contiene le stringhe di testo per la Gui principale di FreeCAD.
  • Si può convalidare le traduzioni esistenti, oppure è possibile crearne di proprie.
 Note: Se si partecipa alla traduzione di FreeCAD, e si desidera essere informati prima della pubblicazione
di una prossima versione che è il momento di rivedere la propria traduzione,
si prega di iscriversi a: http://www.freecadweb.org/tracker/view.php?id=137


Traduzione con Qt-Linguist (forma antiquata - OBSOLETA)

Le seguenti informazioni non devono più essere utilizzate ed è probabile che diventino obsolete.

Sono mantenute qui in modo che i programmatori possano conoscere come funziona.

  • Aprire tutte le cartelle di lingua di FreeCAD riportate in seguito
  • Verificare che non esista un file .ts file con il codice della lingua ("fr" per francese, "de" per tedesco, etc...)
  • Se esiste, è possibile scaricare il file, se si vuole modificare / rivedere / megliorare la traduzione (fare clic sul file, quindi scaricare)
  • Se non esiste, scaricare i file .ts senza il codice della lingua (o qualsiasi altro .ts disponibile, funzionerà ugualmente)
  • Rinominare il file con il codice della propria lingua
  • Aprirlo con il programma Qt-Linguist
  • Iniziare la traduzione (Qt Linguist è molto semplice da usare)
  • Terminata la traduzione, salvare il file
  • Inviare i file in modo da poterli includere nel codice sorgente di FreeCAD e consentire l'utilizzo della traduzione anche ad altri utenti.

Archivio dei file di traduzione disponibili

Preparare i propri moduli o applicazioni per la traduzione

Prerequisiti

Per realizzare la traduzione del modulo dell'applicazione servono delle utility fornite con Qt. Esse si possono scaricare da Trolltech-Website, ma sono anche contenute in LibPack:

qmake
Genera i file del progetto
lupdate
Estrae o aggiorna i testi originali del progetto tramite la scansione del codice sorgente
Qt-Linguist
Qt-Linguist è molto facile da usare, agevola la traduzione con pratiche funzioni e dispone di un frasario per le espressioni più comuni.

Installazione del progetto

Per iniziare la localizzazione del progetto andare alla GUI-Part del prorio modulo e digitare sulla riga di comando:

qmake -project

Questo esegue la scansione della directory del progetto alla ricerca dei file contenenti stringhe di testo e crea un file di progetto come nel seguente esempio:

 ######################################################################
 # Automatically generated by qmake (1.06c) Do 2. Nov 14:44:21 2006
 ######################################################################
 
 TEMPLATE = app
 DEPENDPATH += .\Icons
 INCLUDEPATH += .
 
 # Input
 HEADERS += ViewProvider.h Workbench.h
 SOURCES += AppMyModGui.cpp \
            Command.cpp \
            ViewProvider.cpp \
            Workbench.cpp
 TRANSLATIONS += MyMod_de.ts

È possibile aggiungere manualmente i file qui. La sezione TRANSLATIONS contiene un elenco di file con la traduzione per ogni lingua. Nell'esempio precedente MyMod_de.ts è la traduzione in tedesco.

Ora è necessario eseguire lupdate per estrarre tutte le stringhe letterali nella propria GUI. Eseguire lupdate dopo le modifiche del codice sorgente è sempre una operazione sicura in quanto non cancella mai stringhe dai file di traduzione. Aggiunge solo le nuove stringhe.

Ora è necessario aggiungere i file .ts al proprio progetto VisualStudio. Specificare per essi il seguente metodo di costruzione personalizzato:

python ..\..\..\Tools\qembed.py "$(InputDir)\$(InputName).ts"
                 "$(InputDir)\$(InputName).h" "$(InputName)"

Nota: Inserire questo comando in un'unica riga, l'interruzione di riga è finalizzata solo alla visualizzazione.

Compilando il file .ts dell'esempio precedente, si crea un file di di intestazione MyMod_de.h. La posizione migliore per memorizzare questo file è App<Modul>Gui.cpp. In questo esempio potrebbe essere AppMyModGui.cpp. Aggiungere lì la riga:

new Gui::LanguageProducer("Deutsch", <Modul>_de_h_data, <Modul>_de_h_len);

per pubblicare la traduzione nell'applicazione.

Configurare i file python per la traduzione

Per facilitare la localizzazione dei file .py è possibile utilizzare lo strumento pylupdate4 che accetta uno o più file .py. Con l'opzione -ts si può preparare / aggiornare uno o più file .ts. Ad esempio per preparare un file .ts per la traduzione in francese è sufficiente inserire nella riga di comando:

pylupdate4 *.py -ts YourModule_fr.ts 

lo strumento pylupdate esegue la scansione dei file .py per le funzioni translate() o tr() y e crea un file YourModule_fr.ts. Si può tradurre questo file con QLinguist e produrre il file YourModule_fr.qm con QLinguist o con il comando:

lrelease YourModule_fr.ts

Attenzione che lo strumento pylupdate4 non è molto efficace nel riconoscere le funzioni translate(), esse devono essere formattate in modo molto specifico (vedere come esempio i file del modulo Progetto Draft). All'interno del file, è possibile impostare un traduttore come questo (dopo il caricamento delle QApplication però PRIMA di creare qualsiasi widget Qt):

translator = QtCore.QTranslator()
translator.load("YourModule_"+languages[ln])
QtGui.QApplication.installTranslator(translator)

Facoltativamente, è possibile anche creare il file XML Draft.qrc con questo contenuto:

  
<RCC>
<qresource prefix="/translations" > 
<file>Draft_fr.qm</file> 
</qresource> 
</RCC> 

e eseguire pyrcc4 Draft.qrc -o qrc_Draft.py che crea un grande file Python contenente tutte le risorse. Questo metodo funziona anche per inserire i file di icona in un file di risorse

Tradurre il wiki

Questo wiki ospita svariati contenuti. Il materiale più aggiornato e interessante viene raccolto nel manuale.

Plugin di traduzione

Quando il Wiki è stato spostato da SourceForge, Yorik ha installato un plugin di traduzione che facilita la traduzione delle pagine. Ad esempio, ora può essere tradotto anche il titolo della pagina. Altri vantaggi del plugin di traduzione sono che tiene traccia delle traduzioni, notifica se la pagina originale è stata aggiornata, e mantiene le traduzioni sincronizzate con la pagina originale inglese.

Lo strumento è documentato in Extension:Translate, ed è parte di Language Extension Bundle.

Per sapere come preparare rapidamente una pagina per la traduzione e attivare il plugin, si prega di leggere Page translation example.

Per vedere un esempio di come funziona lo strumento di traduzione quando il plugin di traduzione è attivo su una pagina, è possibile visitare la Main Page. Verrà visualizzata una nuova barra del menu lingua in basso. Esso viene generato automaticamente. Cliccando, per esempio, sul link tedesco, si apre la pagina Main Page/de. Immediatamente sotto al titolo, è possibile leggere "This page is a translated version of a page Main Page and the translation is xx% complete." "Questa pagina è una versione tradotta di Main Page e la traduzione è xx% completa." (xx è la percentuale attuale di traduzione). Cliccare sul link "Translate this page" per avviare la traduzione, o per aggiornare o correggere la traduzione esistente.

Noterete che quando la pagina è stata contrassegnata per la traduzione non è possibile modificarla direttamente, ma che si deve passare attraverso l'utility di traduzione.

Quando si aggiungono nuovi contenuti, prima deve essere creata la pagina inglese, e poi la pagina inglese può essere tradotta in un'altra lingua. Se qualcuno vuole cambiare o aggiungere dei contenuti in una pagina esistente, deve farlo nella pagina inglese, marcarla per la traduzione e poi tradurre i contenuti editati.

It is recommended to have basic knowledge of wiki style formatting and general guidelines of the FreeCAD wiki, because you will have to deal with some tags while translating. You can find this information on WikiPages.

The sidebar (navigation menu on the left) is also translatable. Please follow dedicated instructions on Localisation Sidebar page.

NOTA: La prima volta che una pagina viene passata al nuovo sistema di traduzione perde tutte le sue vecchie traduzioni "manuali". Per recuperare le traduzioni, è necessario aprire una versione precedente dalla cronologia (pulsante History), e fare manualmente il copia/incolla dei precedenti paragrafi nel nuovo sistema di traduzione.

Nota: ovviamente, per poter tradurre nel wiki, è necessario gain richiedere l'autorizzazione.


Se non siete sicuri su come procedere, non esitate a chiedere aiuto nel forum.

Vecchie istruzioni di traduzione

These instructions are for historical background only, while the pages are being passed to the new translation plugin.

So the first step is to check if the manual translation has already been started for your language (look in the left sidebar, under "manual").
If not, head to the forum and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.
You must then gain wiki edit permission.
If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: go into a red page, and copy/paste the contents of the corresponding English page, and start translating.
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use a slash and your language code in almost all the links. Look at other already translated pages to see how they did it.
Add a slash and your language code in the categories, like [[Category:Developer Documentation/fr]]
And if you are unsure, head to the forums and ask people to check what you did and tell you if it's right or not.
Four templates are commonly used in manual pages. These 4 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)

  • Template:GuiCommand : is the Gui Command information block in upper-right of command documentation.
  • Template:Docnav : it is the navigation bar at the bottom of the pages, showing previous and next pages.

Page Naming Convention
Please take note that, due to limitations in the Sourceforge implementation of the MediaWiki engine, we require that your pages all keep their original English counterpart's name, appending a slash and your language code. For example, the translated page for About FreeCAD should be About Freecad/es for Spanish, About FreeCAD/pl for polish, etc. The reason is simple: so that if translators go away, the wiki's administrators, who do not speak all languages, will know what these pages are for. This will facilitate maintenance and avoid lost pages.
If you want the Docnav template to show linked pages in your language, you can use redirect pages. They are basically shortcut links to the actual page. Here is an example with the French page for About FreeCAD.

  • The page About FreeCAD/fr is the page with content
  • The page À propos de FreeCAD contains this code:
#REDIRECT [[About FreeCAD/fr]]
  • In the About FreeCAD/fr page, the Docnav code will look like this:
{{docnav/fr|Bienvenue sur l'aide en ligne|Fonctionnalités}}

The page "Bienvenue sur l'aide en ligne" redirects to Online Help Startpage/fr, and the page "Fonctionnalités" redirects to Feature list/fr.