~openerp-community/openobject-doc/6.1

« back to all changes in this revision

Viewing changes to source/developer/Appendices/appendices_b.rst

  • Committer: TruongSinh Tran
  • Date: 2009-07-19 19:02:35 UTC
  • Revision ID: truongsinh@vipescoserver-20090719190235-fu3bxcrbpvwuk5h7
[FIX] build_i18n.py .. raw:: html

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Releasing a module
 
2
==================
 
3
 
 
4
Introduction
 
5
------------
 
6
 
 
7
You can publish your work under our systems to:
 
8
 
 
9
    * Get help from contributors or interrested partners for the development
 
10
    * Get feedback from testers and translators
 
11
    * Get your module in the next distribution/version of Open ERP (if accepted by the editor) so that you do not have to manage migrations, testing per version, ... 
 
12
 
 
13
Open Forge
 
14
----------
 
15
 
 
16
Here is the process of publishing a module or patch:
 
17
 
 
18
   1. Create a project on http://OpenForge.com
 
19
   2. Upload your work on your Open Forge project
 
20
   3. Create an entry on the module repository of Open ERP's website 
 
21
 
 
22
The Open Forge has tools to help your team collaborate, like message forums, tasks tracker and mailing lists; tools to create and control access to Source Code Management repositories. It is the central repository of collaborative developments for Open ERP. 
 
23
 
 
24
 
 
25
Translations
 
26
============
 
27
 
 
28
Open ERP is multilingual. You can add as many languages as you wish. Each user may work with the interface in his own language. Moreover, some resources (the text of reports, product names, etc.) may also be translated.
 
29
 
 
30
This section explains how to change the language of the program shown to individual users, and how to add new languages to Open ERP.
 
31
 
 
32
Nearly all the labels used in the interface are stored on the server. In the same way, the translations are also stored on the server. By default, the English dictionary is stored on the server, so if the users want to try Open ERP in a language other than English, then you have to store these languages definitions on the server.
 
33
 
 
34
However, it is not possible to store "everything" on the server. Indeed, the user gets some menus, buttons, etc... that must contain some text *even before* being connected to the server. These few words and sentences are translated using GETTEXT. The chosen language by default for these is the language of the computer from which the user connects.
 
35
 
 
36
The translation system of Open ERP is not limited to interface texts; it also works with reports and the "content" of some database fields. Obviously, not all the database fields need to be translated. The fields where the content is multilingual are marked thus by a flag :
 
37
 
 
38
 
 
39
.. figure::  images/field_flag.png
 
40
   :scale: 120
 
41
   :align: left
 
42
 
 
43
        
 
44
How to change the language of the user interface ?
 
45
--------------------------------------------------
 
46
 
 
47
The language is a user preference. To change the language of the current user, click on the menu: User > Preferences.
 
48
 
 
49
.. figure::  images/trans_user_pref.png
 
50
   :scale: 120
 
51
   :align: left
 
52
 
 
53
 
 
54
An administrator may also modify the preferences of a user (including the language of the interface) in the menu: Administration > Users > Users. He merely has to choose a user and toggle on "preferences".
 
55
 
 
56
.. figure::  images/menu_bar_pref.png
 
57
   :scale: 120
 
58
   :align: left
 
59
 
 
60
 
 
61
Store a translation file on the server
 
62
--------------------------------------
 
63
 
 
64
To import a file having translations, use this command:
 
65
 
 
66
    ./openerp_server.py --i18n-import=file.csv -l **LANG** 
 
67
 
 
68
where **LANG** is the language of the translation data in the CSV file.
 
69
 
 
70
Note that the translation file must be encoded in **UTF8!**
 
71
 
 
72
Translate to a new language
 
73
---------------------------
 
74
 
 
75
**Please keep in mind to use the same translation string for identical sources**        . Launchpad Online Translation may give helpful hints.
 
76
 
 
77
More information on accelerators on this website: http://translate.sourceforge.net/wiki/guide/translation/accelerators
 
78
 
 
79
To translate or modify the translation of a language already translated, you have to:
 
80
 
 
81
1. Export all the sentences to translate in a CSV file
 
82
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
83
 
 
84
To export this file, use this command:
 
85
 
 
86
        ./openerp_server.py --i18n-export=file.csv -l**LANG** 
 
87
 
 
88
where **LANG** is the language to which you want to translate the program.
 
89
 
 
90
2. Translate the last column of the file
 
91
++++++++++++++++++++++++++++++++++++++++
 
92
 
 
93
You can make a translation for a language, which has already been translated or for a new one. If you ask for a language already translated, the sentences already translated will be written in the last column.
 
94
 
 
95
For example, here are the first lines of a translation file (Dutch):
 
96
 
 
97
+--------+------------------------+---------+----------------+--------------------+
 
98
| type   | name                   | res_id  |      src       |   value            |
 
99
+--------+------------------------+---------+----------------+--------------------+
 
100
| field  |"account.account,code"  |  0      |    Code        |    Code            |
 
101
+--------+------------------------+---------+----------------+--------------------+
 
102
|  field | "account.account,name" |  0      |    Name        |   Name             | 
 
103
+--------+------------------------+---------+----------------+--------------------+
 
104
|  model | "account.account,name" |  2      |    Assets      |   Aktiva           |
 
105
+--------+------------------------+---------+----------------+--------------------+
 
106
|  model | "account.account,name" |  25     |    Results     |   Salden           |
 
107
+--------+------------------------+---------+----------------+--------------------+
 
108
|  model |"account.account,name"  |   61    |    Liabilities |  Verbindlichkeiten |
 
109
+--------+------------------------+---------+----------------+--------------------+
 
110
 
 
111
3. Import this file into Open ERP (as explained in the preceding section)
 
112
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
113
 
 
114
**Notes**
 
115
 
 
116
    * You should perform all these tasks on an empty database, so as to avoid over-writing data. 
 
117
 
 
118
To create a new database (named 'terp_test'), use these commands:
 
119
 
 
120
    createdb terp_test --encoding=unicode 
 
121
    terp_server.py --database=terp_test --init=all 
 
122
 
 
123
Alternatively, you could also delete your current database with these:
 
124
 
 
125
    dropdb terp 
 
126
    createdb terp --encoding=unicode 
 
127
    terp_server.py --init=all 
 
128
 
 
129
4. Using Launchpad / Rosetta to translate modules and applications
 
130
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
131
 
 
132
A good starting point is here https://launchpad.net/openobject
 
133
 
 
134
**Online**
 
135
 
 
136
Select the module translation section and enter your translation.
 
137
 
 
138
**Offline**
 
139
 
 
140
Use this, if you want to translate some 100 terms.
 
141
 
 
142
It seems mandatory to follow theses steps to successfully complete a translation cycle. (tested on Linux)
 
143
 
 
144
   1. Download the <po file> from Launchpad
 
145
   2. Get the message template file <pot file> from bzr branches
 
146
         1. keep in mind that the <pot file> might not always contain all strings, the <pot files> are updated irregularly.
 
147
         2. msgmerge <pot file> <po file> -o <new po file> 
 
148
   3. translate <new po file> using poedit, kbabel (KDE)
 
149
         1. some programs (like kbabel) allow using dictionaries to create rough translations.
 
150
         2. It is especially useful to create a complete dictionary from existing translations to reuse existing terms related to the application.
 
151
               1. In OpenERP load most/all of the modules
 
152
               2. Load your language
 
153
               3. export all modules of your language as po file and use this one as dictionary. Depending on context of the module this creates 30-80% exact translations. 
 
154
   4. the <new po file> must not contain <fuzzy> comments inserted by kbabel for rough translation
 
155
         1. grep -v fuzzy <new po file> > <po file> 
 
156
   5. check for correct spelling
 
157
         1. msgfmt <po file> -o <mo file> 
 
158
   6. check your translation for correct context
 
159
         1. import the <po file> (for modules)
 
160
         2. install the <mo file> and restart the application (for applications) 
 
161
   7. adjust the translation Online in OpenERP
 
162
         1. check context
 
163
         2. check length of strings
 
164
         3. export <po file> 
 
165
   8. upload <po file> to Launchpad
 
166
         1. keep in mind that Launchpad / Rosetta uses some tags (not sure which) in the header section of the exported <po file> to recognize the imported <po file> as valid.
 
167
         2. after some time (hours) you will receive a confirmation E-Mail (success / error) 
 
168
 
 
169
Using context Dictionary for Translations
 
170
-----------------------------------------
 
171
 
 
172
The context dictionary is explained in details in section "The Objects - Methods - The context Dictionary". If an additional language is installed using the Administration menu, the context dictionary will contain an additional key : lang. For example, if you install the French language then select it for the current user, his or her context dictionary will contain the key lang to which will be associated the value *fr_FR*. 
 
173
 
 
174
        
 
175