Automate the update of translation files #36
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Rebel Engine API and Editor strings are extracted using the
tools/scripts/extract_api_strings.py
andtools/scripts/extract_editor_strings.py
respectively to create the translation template filestranslations/api.pot
andeditor/translations/editor.pot
respectively. These translation templates are then used to update all the untranslated strings in each of the individual translation files (*.po
) usingmsgmerge
. The*.po
and*.pot
files are synced with our Weblate project where the community helps us with all the translations.Currently, the running of
tools/scripts/extract_api_strings.py
,tools/scripts/extract_editor_strings.py
and thenmsgmerge
with the correct parameters is done consistently using twoMakefile
s:translations/Makefile
andeditor/translations/Makefile
respectively. However, runningmake
fromtranslations
andeditor/translations
still needs to be done manually. Furthermore, there is no indication that the Rebel Engine API or Editor strings have been updated.This PR creates a new workflow that runs daily (with an option to run manually). It runs
make
intranslations
andeditor/translations
. If there are changes to the translation template.pot
files and the translation.po
files, it automatically creates a commit and a Pull Request to update the translation template.pot
files and all the individual translation.po
files; so they can be automatically synced with our Weblate project project. It has been designed to either create a new branch or reuse the existing branch to create a new Pull Request or update an existing Pull Request. Although it will test for merge conflicts, these may need to be resolved manually should changes to untranslated strings and translated strings occur both here and on Weblate respectively around the same time. However, scheduling this workflow to run daily should hopefully minimise, if not eliminate, these occurrences. Finally, to prevent Pull Requests being created on forks, the workflow job will only run on this repository.See RebelToolbox/RebelDocumentation#13 for a similar automation used to automatically convert changes to the Rebel Engine API XML documentation to ReST files used to create the Rebel Engine API reference: https://docs.rebeltoolbox.com/en/latest/api/index.html.