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