CI: Add action for pulling new translations (#4911)
* Update and rename translations.yml to translations-push.yml * Rename update_translations.sh to update_translation_source_strings.sh * Update and rename update_translations_template.md to update_translation_source_strings_template.md * Add translations-pull.yml * Update config * Update desktop-lint.yml * Update desktop-build.yml * correct env var naming * names
This commit is contained in:
parent
f728520e97
commit
e9c502ab32
7 changed files with 108 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
||||||
Updated language source strings:
|
Updated source strings for translations:
|
||||||
- {{ .cockatrice_output }} (Cockatrice)
|
- {{ .cockatrice_output }} (Cockatrice)
|
||||||
- {{ .oracle_output }} (Oracle)
|
- {{ .oracle_output }} (Oracle)
|
||||||
|
|
||||||
|
@ -7,5 +7,7 @@ Updated language source strings:
|
||||||
Last changes are based on commit {{ .commit }}.
|
Last changes are based on commit {{ .commit }}.
|
||||||
|
|
||||||
---
|
---
|
||||||
*This PR is automatically generated and updated by the workflow at `.github/workflows/translations.yml`.*<br>
|
*This PR is automatically generated and updated by the workflow at `.github/workflows/translations-push.yml`.*<br>
|
||||||
*After merging, all changes to the source language are available for translation at [Transifex](https://app.transifex.com/cockatrice/cockatrice/) shortly.*
|
*After merging, all changes to the source language are available for translation at [Transifex][1] shortly.*
|
||||||
|
|
||||||
|
[1]: https://app.transifex.com/cockatrice/cockatrice/
|
2
.github/workflows/desktop-build.yml
vendored
2
.github/workflows/desktop-build.yml
vendored
|
@ -8,7 +8,7 @@ on:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'webclient/**'
|
- 'webclient/**'
|
||||||
- '.github/workflows/web-*.yml'
|
- '.github/workflows/web-*.yml'
|
||||||
- '.github/workflows/translations.yml'
|
- '.github/workflows/translations-*.yml'
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
2
.github/workflows/desktop-lint.yml
vendored
2
.github/workflows/desktop-lint.yml
vendored
|
@ -6,7 +6,7 @@ on:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'webclient/**'
|
- 'webclient/**'
|
||||||
- '.github/workflows/web-*.yml'
|
- '.github/workflows/web-*.yml'
|
||||||
- '.github/workflows/translations.yml'
|
- '.github/workflows/translations-*.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
format:
|
format:
|
||||||
|
|
73
.github/workflows/translations-pull.yml
vendored
Normal file
73
.github/workflows/translations-pull.yml
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
name: Update Translations
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
# runs in the middle of each month starting a quarter (UTC) = two weeks after new strings are built
|
||||||
|
- cron: '0 0 15 1,4,7,10 *'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/translations-pull.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
translations:
|
||||||
|
# Do not run the scheduled workflow on forks
|
||||||
|
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
||||||
|
|
||||||
|
name: Pull languages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Pull translated strings from Transifex
|
||||||
|
uses: transifex/cli-action@v2
|
||||||
|
with:
|
||||||
|
# used config file: https://github.com/Cockatrice/Cockatrice/blob/master/.tx/config
|
||||||
|
# https://github.com/transifex/cli#pulling-files-from-transifex
|
||||||
|
token: ${{ secrets.TX_TOKEN }}
|
||||||
|
args: pull --all
|
||||||
|
|
||||||
|
- name: Create pull request
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
id: create_pr
|
||||||
|
uses: peter-evans/create-pull-request@v5
|
||||||
|
with:
|
||||||
|
add-paths: |
|
||||||
|
cockatrice/translations/*.ts
|
||||||
|
oracle/translations/*.ts
|
||||||
|
webclient/public/locales/*/translation.json
|
||||||
|
commit-message: Update translation files
|
||||||
|
# author is the owner of the commit
|
||||||
|
author: github-actions <github-actions@github.com>
|
||||||
|
branch: ci-update_translations
|
||||||
|
delete-branch: true
|
||||||
|
title: '[Translations] Update translations'
|
||||||
|
body: |
|
||||||
|
`pull -all` strings from [Transifex][1]
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
---
|
||||||
|
*This PR is automatically generated and updated by the workflow at `.github/workflows/translations-pull.yml`.*<br>
|
||||||
|
*After merging, all new languages and translations are available in the next build.*
|
||||||
|
|
||||||
|
[1]: https://app.transifex.com/cockatrice/cockatrice/
|
||||||
|
labels: |
|
||||||
|
CI
|
||||||
|
Translation
|
||||||
|
draft: false
|
||||||
|
|
||||||
|
- name: PR Status
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
STATUS: ${{ steps.create_pr.outputs.pull-request-operation }}
|
||||||
|
run: |
|
||||||
|
if [[ "$STATUS" == "" ]]; then
|
||||||
|
echo "PR #${{ steps.create_pr.outputs.pull-request-number }} unchanged!"
|
||||||
|
else
|
||||||
|
echo "PR #${{ steps.create_pr.outputs.pull-request-number }} $STATUS!"
|
||||||
|
fi
|
||||||
|
echo "URL: ${{ steps.create_pr.outputs.pull-request-url }}"
|
|
@ -3,18 +3,18 @@ name: Update Translation Source
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
# runs at the start of each month (UTC)
|
# runs at the start of each quarter (UTC)
|
||||||
- cron: '0 0 1 * *'
|
- cron: '0 0 1 1,4,7,10 *'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '.github/workflows/translations.yml'
|
- '.github/workflows/translations-push.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
translations:
|
translations:
|
||||||
# Do not run the scheduled workflow on forks
|
# Do not run the scheduled workflow on forks
|
||||||
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
||||||
|
|
||||||
name: Update translation source
|
name: Push strings
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -33,7 +33,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
FILE: 'cockatrice/cockatrice_en@source.ts'
|
FILE: 'cockatrice/cockatrice_en@source.ts'
|
||||||
DIRS: 'cockatrice/src common'
|
DIRS: 'cockatrice/src common'
|
||||||
run: .ci/update_translations.sh
|
run: .ci/update_translation_source_strings.sh
|
||||||
|
|
||||||
- name: Update Oracle translation source
|
- name: Update Oracle translation source
|
||||||
id: oracle
|
id: oracle
|
||||||
|
@ -41,13 +41,13 @@ jobs:
|
||||||
env:
|
env:
|
||||||
FILE: 'oracle/oracle_en@source.ts'
|
FILE: 'oracle/oracle_en@source.ts'
|
||||||
DIRS: 'oracle/src'
|
DIRS: 'oracle/src'
|
||||||
run: .ci/update_translations.sh
|
run: .ci/update_translation_source_strings.sh
|
||||||
|
|
||||||
- name: Render template
|
- name: Render template
|
||||||
id: template
|
id: template
|
||||||
uses: chuhlomin/render-template@v1
|
uses: chuhlomin/render-template@v1
|
||||||
with:
|
with:
|
||||||
template: .ci/update_translations_template.md
|
template: .ci/update_translation_source_strings_template.md
|
||||||
vars: |
|
vars: |
|
||||||
cockatrice_output: ${{ steps.cockatrice.outputs.output }}
|
cockatrice_output: ${{ steps.cockatrice.outputs.output }}
|
||||||
oracle_output: ${{ steps.oracle.outputs.output }}
|
oracle_output: ${{ steps.oracle.outputs.output }}
|
||||||
|
@ -64,7 +64,7 @@ jobs:
|
||||||
commit-message: Update translation source strings
|
commit-message: Update translation source strings
|
||||||
# author is the owner of the commit
|
# author is the owner of the commit
|
||||||
author: github-actions <github-actions@github.com>
|
author: github-actions <github-actions@github.com>
|
||||||
branch: ci-update_translations
|
branch: ci-update_translation_source_strings
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
title: '[Translations] Update source strings'
|
title: '[Translations] Update source strings'
|
||||||
body: ${{ steps.template.outputs.result }}
|
body: ${{ steps.template.outputs.result }}
|
27
.tx/config
27
.tx/config
|
@ -1,13 +1,26 @@
|
||||||
[main]
|
[main]
|
||||||
host = https://www.transifex.com
|
host = https://app.transifex.com
|
||||||
|
|
||||||
[cockatrice.cockatrice-translations-cockatrice-en-source-ts--master]
|
[o:cockatrice:p:cockatrice:r:cockatrice-cockatrice-en-source-ts--master]
|
||||||
|
resource_name = Cockatrice
|
||||||
|
source_lang = en
|
||||||
|
source_file = cockatrice/cockatrice_en@source.ts
|
||||||
file_filter = cockatrice/translations/cockatrice_<lang>.ts
|
file_filter = cockatrice/translations/cockatrice_<lang>.ts
|
||||||
source_file = cockatrice/translations/cockatrice_en@source.ts
|
type = QT
|
||||||
source_lang = en
|
minimum_perc = 10
|
||||||
|
|
||||||
[cockatrice.oracle-translations-oracle-en-source-ts--master]
|
[o:cockatrice:p:cockatrice:r:oracle-oracle-en-source-ts--master]
|
||||||
|
resource_name = Oracle
|
||||||
|
source_lang = en
|
||||||
|
source_file = oracle/oracle_en@source.ts
|
||||||
file_filter = oracle/translations/oracle_<lang>.ts
|
file_filter = oracle/translations/oracle_<lang>.ts
|
||||||
source_file = oracle/translations/oracle_en@source.ts
|
type = QT
|
||||||
source_lang = en
|
minimum_perc = 10
|
||||||
|
|
||||||
|
[o:cockatrice:p:cockatrice:r:webclient-src-i18n-default-json--master]
|
||||||
|
resource_name = Webclient
|
||||||
|
source_lang = en
|
||||||
|
source_file = webclient/src/i18n-default.json
|
||||||
|
file_filter = webclient/public/locales/<lang>/translation.json
|
||||||
|
type = KEYVALUEJSON
|
||||||
|
minimum_perc = 10
|
||||||
|
|
Loading…
Reference in a new issue