2019-01-03 01:16:34 +03:00
---
title: Notes for Translators
2019-12-11 12:49:28 +03:00
category: Contributing
2019-12-11 19:01:46 +03:00
layout: default
2021-09-14 17:05:21 +03:00
SPDX-License-Identifier: LGPL-2.1-or-later
2019-01-03 01:16:34 +03:00
---
2018-09-07 11:44:49 +03:00
# Notes for Translators
systemd depends on the `gettext` package for multilingual support.
You'll find the i18n files in the `po/` directory.
The build system (meson/ninja) can be used to generate a template (`*.pot`),
which can be used to create new translations.
It can also merge the template into the existing translations (`*.po`), to pick
up new strings in need of translation.
Finally, it is able to compile the translations (to `*.gmo` files), so that
they can be used by systemd software. (This step is also useful to confirm the
syntax of the `*.po` files is correct.)
2018-10-18 01:56:41 +03:00
## Creating a New Translation
2018-09-07 11:44:49 +03:00
To create a translation to a language not yet available, start by creating the
initial template:
```
2022-04-12 13:05:53 +03:00
$ ninja -C build/ systemd-pot
2018-09-07 11:44:49 +03:00
```
This will generate file `po/systemd.pot` in the source tree.
2022-05-17 17:59:00 +03:00
Then simply copy it to a new `${lang_code}.po` file, where
`${lang_code}` is the two-letter code for a language
2018-09-07 11:44:49 +03:00
(possibly followed by a two-letter uppercase country code), according to the
ISO 639 standard.
In short:
2022-05-17 17:59:00 +03:00
```
$ cp po/systemd.pot po/${lang_code}.po
```
2018-09-07 11:44:49 +03:00
2022-05-17 17:59:00 +03:00
Then edit the new `po/${lang_code}.po` file (for example,
2018-09-07 11:44:49 +03:00
using the `poedit` GUI editor.)
2018-10-18 01:56:41 +03:00
## Updating an Existing Translation
2018-09-07 11:44:49 +03:00
Start by updating the `*.po` files from the latest template:
```
2022-04-12 13:05:53 +03:00
$ ninja -C build/ systemd-update-po
2018-09-07 11:44:49 +03:00
```
This will touch all the `*.po` files, so you'll want to pay attention when
creating a git commit from this change, to only include the one translation
you're actually updating.
Edit the `*.po` file, looking for empty translations and translations marked as
"fuzzy" (which means the merger found a similar message that needs to be
reviewed as it's expected not to match exactly.)
You can use any text editor to update the `*.po` files, but a good choice is
the `poedit` editor, a graphical application specifically designed for this
purpose.
Once you're done, create a git commit for the update of the `po/*.po` file you
touched. Remember to undo the changes to the other `*.po` files (for instance,
using `git checkout -- po/` after you commit the changes you do want to keep.)
2019-12-13 13:56:08 +03:00
## Recompiling Translations
2018-09-07 11:44:49 +03:00
You can recompile the `*.po` files using the following command:
```
2022-04-12 13:05:53 +03:00
$ ninja -C build/ systemd-gmo
2018-09-07 11:44:49 +03:00
```
The resulting files will be saved in the `build/po/` directory.