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