Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate the update of translation files #36

Merged

Conversation

madmiraal
Copy link
Contributor

@madmiraal madmiraal commented Feb 6, 2024

The Rebel Engine API and Editor strings are extracted using the tools/scripts/extract_api_strings.py and tools/scripts/extract_editor_strings.py respectively to create the translation template files translations/api.pot and editor/translations/editor.pot respectively. These translation templates are then used to update all the untranslated strings in each of the individual translation files (*.po) using msgmerge. 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 then msgmerge with the correct parameters is done consistently using two Makefiles: translations/Makefile and editor/translations/Makefile respectively. However, running make from translations and editor/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 in translations and editor/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.

Copy link
Contributor

@DanielaOrtner DanielaOrtner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff!
Automation, for admin tasks like these, is the way forward :)

@DanielaOrtner DanielaOrtner merged commit 934afbf into RebelToolbox:main Feb 6, 2024
13 checks passed
@madmiraal madmiraal deleted the automate-translation-updates branch February 7, 2024 16:57
@madmiraal madmiraal added PR Type: Enhancement Your current game will work better. and removed enhancement labels May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR Type: Enhancement Your current game will work better.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants