Skip to content

Commit ce2efd4

Browse files
committed
feat: add translation management script and update documentation
1 parent 1d8d42d commit ce2efd4

2 files changed

Lines changed: 819 additions & 3 deletions

File tree

‎po/README.md‎

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,66 @@
11
# Translating AppManager
22

3-
## How to Contribute Translations
3+
## Dependencies
44

5-
1. **Edit an existing translation**: Find the relevant `.po` file for your language and submit a PR with your improvements.
6-
2. **Add a new language**: Use `app-manager.pot` as a template, save it as `po/xx.po` (where `xx` is your language code), translate the strings, and create a PR.
5+
Install the required tools before working with translations:
6+
7+
```bash
8+
# Debian / Ubuntu
9+
sudo apt install gettext itstool python3
10+
11+
# Fedora
12+
sudo dnf install gettext itstool python3
13+
```
14+
15+
## Quick Start — Using the Translation Script
16+
17+
The script at `scripts/translations.sh` helps you add or update translations
18+
without needing to touch `.po` files directly.
19+
20+
### 1. Export untranslated strings
21+
22+
This generates a YAML file with all strings that still need translating:
23+
24+
```bash
25+
./scripts/translations.sh --export lv # → po/lv.yaml
26+
```
27+
28+
### 2. Translate
29+
30+
Open the generated YAML file and fill in the `msgstr` fields:
31+
32+
```yaml
33+
entries:
34+
- msgid: "Keep Both"
35+
msgstr: "Paturēt abus"
36+
locations: "src/application.vala:508, src/windows/drop_window.vala:460"
37+
- msgid: "Ignore"
38+
msgstr: "Ignorēt"
39+
locations: "src/application.vala:766"
40+
```
41+
42+
### 3. Import translations
43+
44+
This validates the `.po` file, merges your translations, and validates again:
45+
46+
```bash
47+
./scripts/translations.sh --import lv # reads po/lv.yaml → po/lv.po
48+
```
49+
50+
### 4. Submit
51+
52+
Commit your updated `.po` file and open a pull request.
53+
54+
> **Tip:** If the script reports errors during import, run `./scripts/translations.sh --fix`
55+
> first to automatically mark broken entries as fuzzy, then try importing again.
56+
57+
### Adding a new language
58+
59+
To start a translation for a language that doesn't exist yet:
60+
61+
1. Add the language code to `po/LINGUAS` (e.g. `ru`)
62+
2. Run `./scripts/translations.sh` — it will create the new `.po` from the template
63+
3. Then use `--export` / `--import` as described above
764

865
## Translation Status
966

0 commit comments

Comments
 (0)