diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c503a04..1a79990 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,6 +45,27 @@ quality: expire_in: 1 week when: always +# Translation job: check that all the string.po files use the same strings as +# the reference file +translation: + stage: validation + # Do not get any artifacts from previous jobs + dependencies: [] + rules: + # Run this job only on merge requests containing changes in strings.po + # files and only as "manual" + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + changes: + - resources/language/*/strings.po + when: manual + before_script: + - *apt_get_update + - apt-get install --yes gettext > /dev/null + # We cannot use a simple "find ... -exec msgcmp {} strings.po" because it + # would always return 0 as exit code + script: + - files=$(find . -name strings.po -not -path './resources/language/resource.language.en_gb/*') && for file in $files; do echo -e "\n\033[94mChecking translation file $file\033[0m"; msgcmp $file ./resources/language/resource.language.en_gb/strings.po; done + # Pre-release job: will be available in all the merge requests with release # branches in order to verify the release can be actually created. The # verification is done by running the release script in dry run mode. diff --git a/contributing.md b/contributing.md index 0a65f2e..4a4e8f1 100644 --- a/contributing.md +++ b/contributing.md @@ -59,7 +59,7 @@ It contains 2 classes: received from `addon.py` * PeertubeDownloader: downloads torrent in an independent thread -This module must be as short as possible (15 effective lines of code maximum) +This module should be as short as possible (15 effective lines of code maximum) to comply with Kodi add-on development best practices (checked by the [Kodi add-on checker](https://github.com/xbmc/addon-check)). @@ -141,3 +141,18 @@ These steps should be followed only by maintainers. 4. A new pipeline with the job `create-release` will be created: run the job manually since it should be `blocked` (maintainers only) 5. The new release will be available on the releases page. + +## Translation + +To translate the add-on you may: +* edit one of the `strings.po` file existing in the subfolders of + `resources/language` +* create a new `strings.po` for your language + +A CI job called `translation` is available in each merge request which contains +changes in strings.po files. It checks that the reference strings in the +translation files are the same as in the reference file +([resources/language/resource.language.en_gb/strings.po](./resources/language/resource.language.en_gb/strings.po)). + +More information on the translation system used by Kodi and its add-ons is +available [here](https://kodi.wiki/view/Language_support).