1# i18n
2
3## Creating a new translation
4
5Run: (replace `lang` with the language code)
6```bash
7rm -Rf builddir
8meson builddir --prefix=/tmp/usr
9ninja setzer-pot -C builddir
10cp po/setzer.pot po/lang.po
11```
12Now translate the strings in `lang.po` and add `lang` to the `LINGUAS` file.
13
14## Updating a translation
15
16Run:
17```bash
18rm -Rf builddir
19meson builddir --prefix=/tmp/usr
20ninja setzer-update-po -C builddir
21```
22Now translate the fuzzy strings in `lang.po` (remove the `#,fuzzy` lines).
23
24## Testing a translation
25
26Currently it's not possible to test a translation without an installation in `usr`. Hopefully this will be fixed in a new version of meson (see [mesonbuild/meson#6973](https://github.com/mesonbuild/meson/issues/6973)).
27As a workaround, you can install Setzer with the prefix `/tmp/usr` and run the normal `setzer.dev` script. If you want to test Setzer in a certain language, you can set the `LANGUAGE=lang` environment variable.
28
29## Before opening a PR
30
31- Please don't add any copyright in the first lines in the `.po` file (for copyright simplifications).
32- Check that the `POTFILES` file is up-to-date, you can check this by running `generate-potfiles.sh`.
33- Only commit files you actually translated, discard all other files. Don't commit the `setzer.pot` file.
34- Ensure that your translation has the correct format, you can check this by simply running the update command again, the only diff should be the date.
35- Ensure that the `.mo` file are generated without an error (`ninja setzer-gmo -C builddir`).
36- Please fill in the meta info in line 6+ according to this draft:
37  ```
38  msgid ""
39  msgstr ""
40  "Project-Id-Version: setzer\n"
41  "Report-Msgid-Bugs-To: https://github.com/cvfosammmm/Setzer/issues\n"
42  "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
43  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
44  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
45  "Language-Team: LANGUAGE \n"
46  "Language: lang\n"
47  "MIME-Version: 1.0\n"
48  "Content-Type: text/plain; charset=UTF-8\n"
49  "Content-Transfer-Encoding: 8bit\n"
50  ```
51