|
1 | 1 | # Translating AppManager |
2 | 2 |
|
3 | | -## How to Contribute Translations |
| 3 | +## Dependencies |
4 | 4 |
|
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 |
7 | 64 |
|
8 | 65 | ## Translation Status |
9 | 66 |
|
|
0 commit comments