Translating » History » Version 6
Lukas Zapletal, 04/10/2013 03:44 AM
1 | 6 | Lukas Zapletal | h1. Translating for contributors |
---|---|---|---|
2 | 1 | Lukas Zapletal | |
3 | 6 | Lukas Zapletal | h2. Using Transifex |
4 | 1 | Lukas Zapletal | |
5 | 6 | Lukas Zapletal | Go to https://www.transifex.com/projects/p/foreman and register/login. Then you can use the Transifex interface to do all translations. The project on Transifex automatically updates when we add new strings into git. Foreman team regularly downloads new translations to the develop branch in git as well, therefore there is no action needed when you finish with translations. It will be pulled eventually (e.g. before the next release). |
6 | 1 | Lukas Zapletal | |
7 | 6 | Lukas Zapletal | Read the tips bellow if you want to start translating now. |
8 | |||
9 | h2. Manually |
||
10 | |||
11 | If you prefer, you can edit PO files directly using your preferred editor. Please make sure the encoding of the files is UTF-8. It is also recommended to test your translations before submitting a Pull Request on the github using either: |
||
12 | |||
13 | foreman# rake gettext:pack |
||
14 | |||
15 | or |
||
16 | |||
17 | foreman# make -C locale |
||
18 | |||
19 | The above command should not print any error message. Also you should start Foreman UI and see if your translations do fit (sometimes longer strings can wrap or even break the UI). If you start Foreman in the production mode, you need to do one of the above commands every time you change your translation. In the development mode, you only need to restart Foreman to see the changes. |
||
20 | |||
21 | More info about contributing your translation directly is on our [[Contribute]] wiki page. |
||
22 | |||
23 | h2. Tips when translating |
||
24 | |||
25 | 1 | Lukas Zapletal | There are model names in the translation strings, you can get the full list here: https://github.com/lzap/foreman/blob/develop/locale/model_attributes.rb |
26 | 2 | Lukas Zapletal | |
27 | These model names are in two formats: "Model name" (name of the database table) and "Modelname|Column name" for column name. Here are few examples how to translate them: |
||
28 | |||
29 | _('Compute resource') -> "Compute Resource" |
||
30 | |||
31 | 1 | Lukas Zapletal | _('ComputeResource|Description') -> "Description" |
32 | 2 | Lukas Zapletal | |
33 | Several models have prefixes in the form something/ or Something:: - you can ignore these. Example: |
||
34 | |||
35 | 1 | Lukas Zapletal | _('Audited/adapters/active record/audit') -> "Audit" |
36 | |||
37 | _('Audited::Adapters::ActiveRecord::Audit|Associated name') -> "Associated Name" |
||
38 | |||
39 | 6 | Lukas Zapletal | h1. Translating for developers |
40 | 1 | Lukas Zapletal | |
41 | 6 | Lukas Zapletal | h2. Extracting strings |
42 | 2 | Lukas Zapletal | |
43 | 6 | Lukas Zapletal | There are several rules to follow when marking strings for translations: |
44 | 3 | Lukas Zapletal | |
45 | 6 | Lukas Zapletal | * Do not break strings with newlines because then the strings have many whitespace and it looks confusing for translators like "blah \\n blah". If you must separate string on several lines, you can use HEREDOC or you can contatenate strings like "line1" + "line2" because Ruby Gettext detects them both. |
46 | * If you want to leave a note to the translator, just drop a comment before the string in the format of # TRANSLATORS: your comment here |
||
47 | * Note that all HEREDOC strings are automatically extracted, when adding API documentation descriptions via HEREDOC, leave a message to translators not to translate these (API documentation will not be translated at the moment). |
||
48 | 2 | Lukas Zapletal | |
49 | 6 | Lukas Zapletal | h2. How to pull translations |
50 | 1 | Lukas Zapletal | |
51 | 4 | Lukas Zapletal | To get updated translations from Transifex you will need account there (https://www.transifex.com) and the tx cli tool. |
52 | |||
53 | On Fedora: |
||
54 | |||
55 | # yum -y install transifex-client gettext make intltool |
||
56 | |||
57 | On Debian: |
||
58 | |||
59 | # apt-get install transifex-client gettext make intltool-debian |
||
60 | |||
61 | Then configure your account: |
||
62 | |||
63 | $ cat ~/.transifexrc |
||
64 | [https://www.transifex.net] |
||
65 | hostname = https://www.transifex.net |
||
66 | username = <your_username> |
||
67 | password = <your_password> |
||
68 | token = <should be empty> |
||
69 | |||
70 | And then prepare new topic branch (because the following command will make new commits to your git repo): |
||
71 | |||
72 | git checkout -b update-translations |
||
73 | |||
74 | Finally do the translation pull |
||
75 | |||
76 | make -C locale tx-update |
||
77 | |||
78 | And then you can push changes. |
||
79 | |||
80 | git push ... |