Weblate

From Official Kodi Wiki
Jump to navigation Jump to search

Best practices

Submit your add-on or skin for translation

Only change the content of en_gb source language file.
Never change anything in other language files, as Weblate will handle syncing and maintaining of all strings for all languages.

If you have an open Weblate pull request, always merge that pull request before any other.
Failing to do so could result in merge conflicts at Weblate.
Also merge any open Weblate pull request before changing or adding translations to en_gb source file.

If doing a minor change for an existing source language (en_gb) string, Weblate will most likely treat this as a completely new string.
That means that all existing translations will get removed for that string.
So be careful before you change existing strings.

Sometimes Weblate will add commented out translations at the end of language files.
These should not be removed and are harmless.
They are kept as part of translation memory and will benefit translators in a number of ways.

Workflows and scripts

We offer several workflows to help integrate Weblate translations into your add-ons.

sync-addon-metadata-translations.yml

This workflow will sync metadata (description, summary, disclaimer etc.) between addon.xml and the language files.
It will add this metadata from addon.xml to each language file to allow translation at Weblate.
Whenever changes are done to either addon.xml or any language file, the workflow will run and sync changes both ways.
Either a pull request or direct commit can be created.

An amt-sync branch is created by the workflow where changes are pushed before a pull request is created.
Once the pull request is merged the branch can be safely deleted.
Make sure branch protection is disabled for amt-sync branch and that force pushing is allowed.

This workflow is required for proper Weblate translations.

increment_version.py

This workflow will bump the version number in your addon.xml file whenever changes are done to the language files.
It can be configured to create a changelog entry as well.
Either a pull request or direct commit can be created.

An inc-ver branch is created by the workflow where changes are pushed before a pull request is created.
Once the pull request is merged the branch can be safely deleted.
Make sure branch protection is disabled for inc-ver branch and that force pushing is allowed.

Weblate configuration and add-ons

The text in your Weblate pull request or direct commit can be changed exactly as you see fit.

We enable several add-ons for your component(s) at Weblate.
Most of them will be enabled with default configuration, but some of them can be configured to your preference.

Squash Git commits

This add-on will squash all Weblate commits into a single one.
But it can also create one commit per language or per file if wanted.

Customize gettext output

Default for this add-on is to only wrap lines at newlines.
But it can also wrap lines at 77 characters and at newlines or do no line wrapping.