ci(crowdin): add config file, plural support

This commit is contained in:
Pun Butrach 2023-09-10 13:51:18 +07:00
parent 4fa78df4fd
commit 49a13ada59
No known key found for this signature in database
GPG key ID: DBA94253E1D3F267
2 changed files with 23 additions and 11 deletions

19
.github/crowdin.yml vendored Normal file
View file

@ -0,0 +1,19 @@
project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN
preserve_hierarchy: true
pull_request_title: 'chore(translation): sync translation with Crowdin'
commit_message: 'chore(translation): sync translation with Crowdin'
pull_request_labels: 'translation'
files: [
{
source: 'app/src/res/values/strings.xml',
translation: 'app/src/res/values-%android_code%/strings.xml'
}
{
source: 'app/src/res/values/plurals.xml',
translation: 'app/src/res/values-%android_code%/plurals.xml'
}
]

View file

@ -7,34 +7,27 @@ on:
- "app/src/res/values/strings.xml" - "app/src/res/values/strings.xml"
- ".github/workflows/crowdin.yml" - ".github/workflows/crowdin.yml"
schedule: schedule:
- cron: "0 0 * * *" - cron: "0 0 * * 1"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
synchronize-with-crowdin: synchronize-with-crowdin:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Crowdin action - name: Crowdin action
uses: crowdin/github-action@v1 uses: crowdin/github-action@v1
# TODO: Move to Crowdin configuration file
with: with:
config: ".github/crowdin.yml"
upload_sources: true upload_sources: true
upload_translations: false upload_translations: false
download_translations: true download_translations: true
localization_branch_name: crowdin_translations
create_pull_request: true create_pull_request: true
pull_request_title: 'chore(translation): sync translation with Crowdin' localization_branch_name: "crowdin_translations"
pull_request_body: 'Lorem, foobarit:tm:!' pull_request_base_branch_name: "dev"
pull_request_labels: 'translation'
pull_request_base_branch_name: 'dev'
# TODO: add plurals.xml
source: 'app/src/res/values/strings.xml'
translation: 'app/src/res/values-%android_code%/strings.xml'
env: env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}