Translating Openbravo/it
Contents |
Introduzione
Questo documento spiega il processo di traduzione e manutenzione delle traduzioni di Openbravo ERP in diversi linguaggi.
Il processo coinvolge 5 passi :
- Creare un nuovo linguaggio.
- Copiare le traduzioni del linguaggio base.
- Esportare i files XML da tradurre
- Tradurre i files.
- Finalmente, importare le nuove traduzioni nel system.
Creare e attivare un Linguaggio
Per tradurre le voci presenti in Openbravo ERP, il primo passo è di creare il linguaggio o attivarne uno già definito . Ci sono già molti linguaggi elencati cosicchè di solito l'utente deve solo attivare quello scelto.
L'utente deve loggarsi in Openbravo ERP usando il ruolo System Administrator . Poi deve selezionare la voce di menu 'General Setup > Application > Language.
Qui il linguaggio scelto può essere selezionato dalla lista (se l'utente non è nella Visualizzazione a Griglia, dovrebbe cliccare l'icona griglia) o si può crearlo. Se un nuovo linguaggio viene creato deve seguire la convenzione Java per la nazione e il linguaggio : il linguaggio con 2 lettere minuscole seguite da underscore (_) e la nazione con 2 lettere maiuscole (e.g. fr_CN associato al Canada con linguaggio Francese). Checcando il System Language e salvando il record , l'utente attiva il linguaggio da tradurre e da questo punto , appare nelle preferenze utente.
Il passo successivo è copiare tutto il testo dal linguaggio base al nuovo linguaggio. Il linguaggio base è il linguaggio usato come punto di partenza per tradurre l'applicazione, ed è l'Inglese (en_US). Cliccando sul pulsante Verifica Linguaggi tutte le stringhe per il linguaggio base sono copiati nel nuovo linguaggio.
Pack del Linguaggio
Struttura
A language pack is a set of XML files containing the translations for a desired language. Each file contains the translation for a single table in the database and is given the same name as the table which contains its corresponding translation.
These language packs are stored in a server directory by language using the convention of language and country (e.g. en_US, es_ES...). They are inside a lang directory in the folder that is defined to contain all attachments. This is defined in your local build.xml file (for 2.3x versions) or Openbravo.properties file (for 2.4x versions), is requested during the installation process and, by default, is /attachments. An example of a complete path for Spanish_Spain could be /attachments/lang/es_ES.
The structure of the XML is as follows:
- A tag containing the table and the language names.
- For each row in the table there will be a row tag with attributes id for the row identification and trl which will be Y or N depending on whether or not it has been translated.
- Inside the row tag, there is a value tag for each column in the table. This tag includes the attributes column for the column name and original signifying the value for the column in the base language (English). The value for the tag will contain the translated text. This is the text that you have to change if you want to make a translation.
The following piece of code is an example for /attachments/lang/es_ES/AD_TASK_TRL_es_ES.xml file:
<?xml version="1.0" encoding="UTF-8"?> <compiereTrl language="es_ES" table="AD_TASK"> <row id="102" trl="Y"> <value column="Name" original="Java Version">Versión de java</value> <value column="Description" original="Displays the version of the default Java VM">Muestra la versión de la java VM por defecto</value> <value column="Help" original="The java version used by the application might be different."/> </row> <row id="103" trl="N"> <value column="Name" original="Database Export">Exportar BD</value> <value column="Description" original="Export (save) the database">Exportar (guardar) la base de datos</value> <value column="Help" original="Run this command from the server">Run this command from the server</value> </row> </compiereTrl>
The complete list of XML files that compose a language pack called lg_CT, where lg stands for language and CT for country, is:
- AD_ALERTRULE_TRL_lg_CT.xml: Translations for AD_AlertRule table.
- AD_ELEMENT_TRL_lg_CT.xml: Translations for the AD_Element table. This table contains all the elements of the application. They are used in order to have centrally maintained a description and help of the elements.
- AD_FIELDGROUP_TRL_lg_CT.xml: Translations for AD_FieldGroup table. Field groups are used to group a fields in a window.
- AD_FIELD_TRL_lg_CT.xml: Translations for the AD_Field table. This table holds the information about the fields that are shown in each window of the application.
- AD_FORM_TRL_lg_CT.xml: Translations for the AD_Form table, where are defined the name, description and help for all the forms of the application. A form is a manually generated window.
- AD_MENU_TRL_lg_CT.xml: Translations for AD_Menu table. Here can be found the menu tree that appears on the left side of the application.
- AD_MESSAGE_TRL_lg_CT.xml: Translations for AD_Message table. This table defines all the messages that application displays.
- AD_PROCESS_PARA_TRL_lg_CT.xml: Translations for the AD_Process_Para table.
- AD_PROCESS_TRL_lg_CT.xml: Translations for AD_Process table. Here appears the name, description and help for the processes invoked from the application.
- AD_REFERENCE_TRL_lg_CT.xml: Translations for AD_Reference table. In this table are all the references. References are used to define data types, lists of values or tables.
- AD_REF_LIST_TRL_lg_CT.xml: Translations for AD_Ref_List table. In this table are found the values for the references of list type.
- AD_TAB_TRL_lg_CT.xml: Translations for AD_Tab table. This table contains the name, description and help for all the tabs in the application.
- AD_TASK_TRL_lg_CT.xml: Translations for AD_Task table. Definition of system tasks.
- AD_TEXTINTERFACES_TRL_lg_CT.xml: Translations for AD_TextInterfaces table. This table holds the texts that will be displayed in all the manually generated windows.
- AD_WF_NODE_TRL_lg_CT.xml: Translations for AD_WF_Node table. This table contains the workflow nodes.
- AD_WINDOW_TRL_lg_CT.xml: Translations for AD_Window table. AD_Window has names, descriptions and helps of the WAD generated windows.
- AD_WORKFLOW_TRL_lg_CT.xml: Translations for AD_Workflow table. Name, description and help for the defined workflows.
- AT_COMMAND_TRL_lg_CT.xml: Translations for AT_Command table. This table is not used at this moment.
- C_COUNTRY_TRL_lg_CT.xml: Translations for C_Country table. This table holds a list of countries.
- C_CURRENCY_TRL_lg_CT.xml: Translations for C_Currency table. This table holds a list of currencies.
- C_DOCTYPE_TRL_lg_CT.xml: Translations for C_DocType table. Description of the document types.
- C_ELEMENTVALUE_TRL_lg_CT.xml: Translations for C_ElementValue table. This table contains the values for the elements used in accounting.
- C_GREETING_TRL_lg_CT.xml: Translations for C_Greeting table.
- C_PAYMENTTERM_TRL_lg_CT.xml: Translations for C_PaymentTerm table. Name and description for payment terms.
- C_TAXCATEGORY_TRL_lg_CT.xml: Translations for C_TaxCategory table. Name and description for the tax categories.
- C_TAX_TRL_lg_CT.xml: Translations for C_Tax table. Name and description for taxes.
- C_UOM_TRL_lg_CT.xml: Translations for C_UOM table. This table contains the Units of Measure.
- M_PRODUCT_TRL_lg_CT.xml: Translations for M_Product table. A table containing the different products.
Tradurre usando i files PO
PO (Portable Object) is a very popular format for storing and translating many open source applications. Openbravo ERP uses XML to import and export translations. However, with little effort, these XML files can be converted into PO files, that are more easy and friendly to work with.
PO files have a very simple structure. They look like:
#: AD_MENU_TRL_en_US.xml:1(value) msgid "original text" msgstr "translated text"
There is detailed description of the format in the GNU gettext utilities manual.
Software richiesto
To translate Openbravo using PO files, the following software is required:
- Openbravo2PO which is a tool written specifically for working with Openbravo ERP generated XML files. Transforms XML format files to PO format and back to XML format. Another use is to merge multiple PO files of the same type (table, element, language) to a single file.
- Java version 1.5
- Ant version 1.7.0
Generare un file PO da un file XML
Language files are exported from Openbravo ERP in XML format, in order to translate these files efficiently it is necessary to transform them into PO format files.
Detailed instructions on using this tool can be found at Openbravo2PO User Documentation
To transform xml files to po format use the following ant command
ant runXML2PO -DinpFold= -DoutFold= -DmsgStr= -Dfile=""
add values as required to the various target arguments. If the -DinpFold is given and the -Dfile is empty the tool will generate PO files for all XML files in the input folder, otherwise only those files included in the -Dfile argument will be transformed. The -Dfile argument can take multiple files separated by a space character but must be enclosed in "".
e.g. to transform all xml files in a folder to po files
ant runXML2PO -DinpFold=/home/openbravo/translations/xml_base/ -DoutFold=/home/openbravo/translations/po_out/ -DmsgStr=false
e.g. to transform a single xml file
ant runXML2PO -DinpFold=/home/openbravo/translations/xml_base/ -DoutFold=/home/openbravo/translations/po_out/ -DmsgStr=false -Dfile="AD_TASK_TRL_es_ES.xml"
Tradurre files PO
To translate a PO into your language you can use one of the many open source tools and editors available. Some of the most popular are:
- PoEdit. A cross-platform gettext catalogs editor.
- KBabel. A graphical PO editor for the KDE environment.
- Gtranslator. A graphical PO editor for the GNOME environment.
Generare un file XML da un file PO
Once the translation is complete you have to put the translations back into XML format.
Detailed instructions on using this tool can be found at Openbravo2PO User Documentation
To generate the XML files from the PO files use the following ant target
ant runPO2XML -DinpFold= -DoutFold= -Dfile=""
Again specifying the inpFold and not the file names will parse all PO files into the relevant xml files ready to be imported back into Openbravo ERP. The -Dfile argument can take multiple files separated by a space character but must be enclosed in "".
e.g. to process a complete folder
ant runPO2XML -DinpFold=/home/openbravo/translations/po_out/ -DoutFold=/home/openbravo/translations/xml_trl
e.g. to process specific file(s)
ant runPO2XML -DinpFold=/home/openbravo/translations/po_out/ -DoutFold=/home/openbravo/translations/xml_trl -Dfile="AD_TASK_Name_es_ES.po AD_TASK_Help_es_ES.po AD_TASK_Description_es_ES.po"
Export/Import
To export or import a language the user must log into the application as System Administrator and go to General Setup > Application > Import/Export Translations ( the language must be activated in the system first).
Here the user can choose one of the languages defined as System Language.
- Export: Creates the language directory (see above) if it does not already exist and exports the files for the selected language to the directory.
- Import: Reads the files from the selected language directory and import them into the application database tables.
The desired language XML files are located in the following directory: attachments/lang/en_US
- The location of the attachments folder is configured in the attach.path property in your local build.xml file (for 2.3x versions) or Openbravo.properties file (for 2.4x versions).
- en_US should be replaced with the code for your particular language.
See the Installing a new translation section if you are importing translations.
Manutenere una Traduzione
Se l'utente non vuole fare una traduzione completa ne cambi significativi, può modificare una traduzione in vari modi , senza exportare/modificare/importare i files XML . Ogni tabella che ha una traduzione (quelle che sono esportate nei files XML ), ha anche nella propria finestra un tab chiamato Traduzione. Qui, traduzioni possono essere modificate per ogni riga della tabella. Per esempio, se l'utente vuole solo cambiare la traduzione Italiana per l'elemento AccountType , questo cambio è fatto dal tab Application Dictionary > Setup > Element > Translation .
Installare una nuova traduzione
To install a new translation in Openbravo follow these steps:
- Click upper-left side in the corner, the User Preferences Button
which is located left to the name Openbravo.
- Choose the role System Administrator and click the OK Button.
- Go to the General Setup > Application > Language menu option.
- Search for the language that you want to import, e.g. german% for Germany.
- Mark System Language check box then Save the record (it has a disk as an image). Do not check the Base Language check box.
- Press the Verify Languages button to create the records for the language (if you already performed this action, result of the process should be 0, otherwise, the amount of new records created will be shown). An easy way to confirm that the process run correctly is to check that new lines have been created in the translation tab of the windows. For example:
- Go to Application Dictionary > Setup > Element.
- Go to Translation tab.
- Verify that a new line has been created for the choosen language. The contains of the tab should be en English. The real translation will take place in the following steps. If there is no new line make sure you have saved the record after checking System language check box and press Verify language again.
- Now, create in the Openbravo directory (where you installed Openbravo ERP), a folder named AppsOpenbravo/attachments/lang/de_DE (for Germany, in any other case, lg_CT corresponding to your language_COUNTRY).
- After that, download the translated XML files (in ZIP format) for your country. Unzip and copy them to AppsOpenbravo/attachments/lang/lg_CT folder.
- Go to General Setup > Application > Import/Export Translations menu. Select System value in Entity combo box and the language that you want to import in Language combo box. If you do not see the language that you want to import:
- Go back to General Setup > Application > Language.
- Select the language that you want to import, mark System Language check box then Save the record.
- Press the Verify Languages button to create the records for the language (if you already performed this action, result of the process should be 0).
- Press the Import button to start the import of the translation. An easy way to confirm that the process run correctly is to check that the lines in the translation tab of the windows have been translated. For example:
- Go to Application Dictionary > Setup > Element.
- Go to Translation tab.
- Verify that the record is displayed with the content translated to the choosen language. If results keep displaying in English, press the Import button again.
Once the translation is imported or changes have been made, the modifications do not take effect until Openbravo ERP is recompiled and a new openbravo.war is deployed.
- It is recommended to stop the web server before starting the compiling process. For example: if using Tomcat as web server in a Linux, shut it down by typing the command:
service tomcat stop
- Once is stopped, start the Openbravo compilation by process by typing:
ant compile.complete
Important note: if you find this error compileSqlc: BUILD FAILED ...AppsOpenbravo/build.xml:85: The following error occurred while executing this line: ...AppsOpenbravo/src/build.xml:176: srcdir "...AppsOpenbravo/build/javasqlc/srcAD/org/openbravo/er pCommon/reference" does not exist! try to run: ant core.lib wad.lib trl.lib If success, run again: ant compile.complete |
This process compiles and translates every window in the application.
- Now, create the openbravo.war file and deploy it to Apache Tomcat by typing:
ant war ant deploy
- Restart the web server by typing:
service tomcat start
Important note: at this point, you should have inside Apache Tomcat webapps folder (C:\Apache Software Foundation\Tomcat5.5\webapps\ or C:\Tomcat5.5\webapps\ in Microsoft Windows and /var/lib/tomcat5.5/webapps/ in Linux):
If this is not the case: service tomcat stop ant compile.complete ant war ant deploy service tomcat start Sometimes when you have yet deployed openbravo application to the Apache Tomcat webapps folder, you could continue experiencing problems. Try: service tomcat stop delete your_context_name folder (e.g., openbravo) inside Apache Tomcat webapps folder. service tomcat start your_context_name folder should be re-created with the src-loc/lg_CT subfolders inside it.
|
- Now login into Openbravo ERP and you will be able set your language in the User Preferences
. If you want to login and see directly all menus into your language, mark the check-box Set as Default.