forked from PythonFreeCourse/calendar
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/translations workflow (PythonFreeCourse#150)
* feat: add translations workflow * fix(translations-workflow): fix doc * fix(translations-workflow): fixed code and added automatic commit Co-authored-by: Gonny <1@1>
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This workflow will extract new translatable strings from files under /app and /tests into a base.pot file, | ||
# and update the 'en' and 'he' base.po and base.mo files. | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: update-translations | ||
|
||
on: [push] | ||
|
||
jobs: | ||
update-translations: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Create base.pot file | ||
run: pybabel extract --mapping-file=app/babel_mapping.ini app tests -o app/locales/base.pot -c i18n | ||
|
||
- name: Move to /app directory | ||
run: cd app | ||
|
||
- name: Update all language base.po files | ||
run: pybabel update -i locales/base.pot -d locales -D base | ||
|
||
- name: Update all .mo files | ||
run: pybabel compile -d locales -D base | ||
|
||
# https://github.com/stefanzweifel/git-auto-commit-action | ||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Apply automatic translateable string changes |