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