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