From 6a8177ca25e80d1bea3026b63be40f2e9c88db86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A9tous?= Date: Mon, 26 Apr 2021 22:55:40 +0200 Subject: [PATCH] Create a CI job to check strings.po files --- .gitlab-ci.yml | 16 ++++++++++++++++ contributing.md | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c503a04..ab6ae9d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,6 +45,22 @@ 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 on strings.po + # files and only as "manual" + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + changes: + - resources/language/*/strings.po + when: manual + script: + - files=$(find . -name strings.po -not -path './resources/language/resource.language.en_gb/*') && for file in files; do 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..717fca7 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-on is +available [here](https://kodi.wiki/view/Language_support).