Skip to content

Commit

Permalink
PICARD-2731: Update documentation for Weblate
Browse files Browse the repository at this point in the history
  • Loading branch information
phw committed Aug 22, 2023
1 parent c55f295 commit 78debcc
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ We follow the "typical" GitHub workflow when contributing changes:

## Translations

See po/README.md for information about translations.
See [po/README.md](./po/README.md) for information about translations.


## User Documentation
Expand Down
6 changes: 0 additions & 6 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ This shouldn't be needed, but better to check before releasing
git ls-tree --full-tree -r HEAD --name-only |while read f; do sed -i '1s/^\xEF\xBB\xBF//' "$f"; done && git diff --quiet || git commit -a -m 'Remove nasty BOM bytes'
```

## Get latest translations from Transifex

```bash
python setup.py pull_translations && git diff --quiet || git commit -m 'Update .po files' -- po/
```

## Synchronize generated consts

```bash
Expand Down
2 changes: 1 addition & 1 deletion org.musicbrainz.Picard.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<url type="faq">https://picard-docs.musicbrainz.org/en/faq/faq.html</url>
<url type="help">https://picard-docs.musicbrainz.org/</url>
<url type="donation">https://metabrainz.org/donate</url>
<url type="translate">https://www.transifex.com/musicbrainz/musicbrainz/picard/</url>
<url type="translate">https://translations.metabrainz.org/projects/picard/</url>

<translation type="gettext">picard</translation>
<developer_name>MetaBrainz Foundation</developer_name>
Expand Down
62 changes: 41 additions & 21 deletions po/README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,77 @@
Translations
============

Picard translations are handled by [Transifex](https://www.transifex.com).
Picard translations are handled by [Weblate](https://translations.metabrainz.org/projects/picard/). For translation instructions please see [Picard, Picard Website and Picard User Guide Internationalization](https://wiki.musicbrainz.org/MusicBrainz_Picard/Internationalization).

The translation files are automatically synced between the Picard Github repository and Weblate. Translations can be done in Weblate or by updating the translation files directly.

Below is a technical description for managing the translations as a Picard maintainer or developer.

_Please do not manually edit the PO files._

Required tools
--------------

* [Transifex client 1.x](https://developers.transifex.com/docs/cli)
* [Weblate Client](https://docs.weblate.org/en/latest/wlc.html)
* [Babel](https://babel.pocoo.org/)


Picard source tree strings
--------------------------

Their translations are handled at <https://www.transifex.com/musicbrainz/musicbrainz/picard/>
Their translations are handled at <https://translations.metabrainz.org/projects/picard/app/>

One can update `picard.pot` using:

```bash
$ python setup.py regen_pot_file
```

Transifex will _automatically_ pick `picard.pot` from [Picard git repository master branch](https://github.com/metabrainz/picard/tree/master) once per day.
Weblate will _automatically_ sync the changed `picard.pot` and update the translation files (`*.po`) with msgmerge.


Attributes and countries strings
--------------------------------
AppStream metadata translations
-------------------------------

Their translations are handled at <https://www.transifex.com/musicbrainz/musicbrainz/attributes/> and <https://www.transifex.com/musicbrainz/musicbrainz/countries/>
Translations for the strings from `org.musicbrainz.Picard.appdata.xml.in` are handled at <https://translations.metabrainz.org/projects/picard/appstream/>.

`attributes.pot` and `countries.pot` are updated by [musicbrainz-server project](https://github.com/metabrainz/musicbrainz-server), outside the Picard project.
One can update `appstream/picard-appstream.pot` using:

Picard maintainers can regenerate `picard/const/attributes.py` and `picard/const/countries.py`, which are using `attributes.pot` and `countries.pot` as base, using the command:
```bash
$ python setup.py update_constants
$ python setup.py regen_appdata_pot_file
```
It will retrieve and parse latest `attributes.pot` and `countries.pot` to rebuild `picard/const/attributes.py` and `picard/const/countries.py`.

Weblate will _automatically_ sync the changed `picard-appstream.pot` and update the translation files (`appstream/*.po`) with msgmerge.


Windows installer translations
------------------------------

To fetch latest translations from Transifex
-------------------------------------------
The translations for the Windows installer are inside the JSON files in `installer/i18n/sources`.
Translation in Weblate is done at <https://translations.metabrainz.org/projects/picard/installer/>


Attributes and countries strings
--------------------------------

Their translations are handled at <https://translations.metabrainz.org/projects/musicbrainz/attributes/> and <https://translations.metabrainz.org/projects/musicbrainz/countries/>

`attributes.pot` and `countries.pot` are updated by [musicbrainz-server project](https://github.com/metabrainz/musicbrainz-server), outside the Picard project.

Picard maintainers can regenerate `picard/const/attributes.py` and `picard/const/countries.py`, which are using `attributes.pot` and `countries.pot` as base. For this an Weblate API key is required, which can be found in your Weblate user settings under [API access](https://translations.metabrainz.org/accounts/profile/#api). The constants can then be updated with the following command:

Use the following command:

```bash
$ python setup.py pull_translations
$ python setup.py update_constants --weblate-key={YOUR_WEBLATE_API_KEY}
```

It will fetch all po files from Transifex, but the most incomplete ones.
Instead of entering the Weblate API key each time you can also place a file `.weblate.ini` in the root of the repository with the following content:

The minimum acceptable percentage of a translation in order to download it can be seen using:
```bash
$ python setup.py pull_translations --help
```ini
[weblate]
url = https://translations.metabrainz.org/api/

[keys]
https://translations.metabrainz.org/api/ = YOUR_WEBLATE_API_KEY
```
The percentage value is passed to the `tx pull` command.

It will retrieve and parse latest `attributes.pot` and `countries.pot` to rebuild `picard/const/attributes.py` and `picard/const/countries.py`.

0 comments on commit 78debcc

Please sign in to comment.