Project

General

Profile

Translating » History » Version 5

Lukas Zapletal, 04/09/2013 11:06 AM

1 2 Lukas Zapletal
h1. Translating (for contributors)
2 1 Lukas Zapletal
3
How to translate Foreman
4
5 5 Lukas Zapletal
h2. Before you start
6
7
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
8
9
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:
10
11
 _('Compute resource') -> "Compute Resource"
12
13
 _('ComputeResource|Description') -> "Description"
14
15
Several models have prefixes in the form something/ or Something:: - you can ignore these. Example:
16
17
 _('Audited/adapters/active record/audit') -> "Audit"
18
19
 _('Audited::Adapters::ActiveRecord::Audit|Associated name') -> "Associated Name"
20
21 1 Lukas Zapletal
h2. Using Transifex
22
23 2 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).
24
25
h2. Manually
26
27
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:
28
29
  foreman# rake gettext:pack
30
31
or
32
33 1 Lukas Zapletal
  foreman# make -C locale
34 3 Lukas Zapletal
35
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.
36 2 Lukas Zapletal
37
More info about contributing your translation directly is on our [[Contribute]] wiki page. 
38
39
h1. How to pull translations (for developers)
40 1 Lukas Zapletal
41 4 Lukas Zapletal
To get updated translations from Transifex you will need account there (https://www.transifex.com) and the tx cli tool.
42
43
On Fedora:
44
45
  # yum -y install transifex-client gettext make intltool
46
47
On Debian:
48
49
  # apt-get install transifex-client gettext make intltool-debian
50
51
Then configure your account:
52
53
  $ cat ~/.transifexrc
54
  [https://www.transifex.net]
55
  hostname = https://www.transifex.net
56
  username = <your_username>
57
  password = <your_password>
58
  token = <should be empty>
59
60
And then prepare new topic branch (because the following command will make new commits to your git repo):
61
62
  git checkout -b update-translations
63
64
Finally do the translation pull
65
66
  make -C locale tx-update
67
68
And then you can push changes.
69
70
  git push ...