]>
Commit | Line | Data |
---|---|---|
c3e270f4 FB |
1 | --- |
2 | title: Notes for Translators | |
4cdca0af | 3 | category: Contributing |
b41a3f66 | 4 | layout: default |
c3e270f4 FB |
5 | --- |
6 | ||
b6dc0d7d FB |
7 | # Notes for Translators |
8 | ||
9 | systemd depends on the `gettext` package for multilingual support. | |
10 | ||
11 | You'll find the i18n files in the `po/` directory. | |
12 | ||
13 | The build system (meson/ninja) can be used to generate a template (`*.pot`), | |
14 | which can be used to create new translations. | |
15 | ||
16 | It can also merge the template into the existing translations (`*.po`), to pick | |
17 | up new strings in need of translation. | |
18 | ||
19 | Finally, it is able to compile the translations (to `*.gmo` files), so that | |
20 | they can be used by systemd software. (This step is also useful to confirm the | |
21 | syntax of the `*.po` files is correct.) | |
22 | ||
991b4350 | 23 | ## Creating a New Translation |
b6dc0d7d FB |
24 | |
25 | To create a translation to a language not yet available, start by creating the | |
26 | initial template: | |
27 | ||
28 | ``` | |
29 | $ ninja -C build/ systemd-pot | |
30 | ``` | |
31 | ||
32 | This will generate file `po/systemd.pot` in the source tree. | |
33 | ||
34 | Then simply copy it to a new <code><i>${lang_code}</i>.po</code> file, where | |
35 | <code><i>${lang_code}</i></code> is the two-letter code for a language | |
36 | (possibly followed by a two-letter uppercase country code), according to the | |
37 | ISO 639 standard. | |
38 | ||
39 | In short: | |
40 | ||
41 | <pre> | |
42 | $ cp po/systemd.pot po/<i>${lang_code}</i>.po | |
43 | </pre> | |
44 | ||
45 | Then edit the new <code>po/<i>${lang_code}</i>.po</code> file (for example, | |
46 | using the `poedit` GUI editor.) | |
47 | ||
991b4350 | 48 | ## Updating an Existing Translation |
b6dc0d7d FB |
49 | |
50 | Start by updating the `*.po` files from the latest template: | |
51 | ||
52 | ``` | |
53 | $ ninja -C build/ systemd-update-po | |
54 | ``` | |
55 | ||
56 | This will touch all the `*.po` files, so you'll want to pay attention when | |
57 | creating a git commit from this change, to only include the one translation | |
58 | you're actually updating. | |
59 | ||
60 | Edit the `*.po` file, looking for empty translations and translations marked as | |
61 | "fuzzy" (which means the merger found a similar message that needs to be | |
62 | reviewed as it's expected not to match exactly.) | |
63 | ||
64 | You can use any text editor to update the `*.po` files, but a good choice is | |
65 | the `poedit` editor, a graphical application specifically designed for this | |
66 | purpose. | |
67 | ||
68 | Once you're done, create a git commit for the update of the `po/*.po` file you | |
69 | touched. Remember to undo the changes to the other `*.po` files (for instance, | |
70 | using `git checkout -- po/` after you commit the changes you do want to keep.) | |
71 | ||
ff2c2d08 | 72 | ## Recompiling Translations |
b6dc0d7d FB |
73 | |
74 | You can recompile the `*.po` files using the following command: | |
75 | ||
76 | ``` | |
77 | $ ninja -C build/ systemd-gmo | |
78 | ``` | |
79 | ||
80 | The resulting files will be saved in the `build/po/` directory. |