feat: setup Crowdin

This commit is contained in:
Andrii Bodnar 2024-05-14 15:31:40 +03:00
parent e876d03608
commit 8d21844f2f
2 changed files with 52 additions and 0 deletions

40
.github/workflows/localization.yml vendored Normal file
View file

@ -0,0 +1,40 @@
# This workflow will run Crowdin Action that will upload new texts to Crowdin, download the newest translations and create a PR
# For more information see: https://github.com/crowdin/github-action
name: Crowdin Sync
on:
push:
branches: [ main ]
paths:
- 'locales/en.yml'
jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Crowdin
uses: crowdin/github-action@v1
with:
# Upload sources to Crowdin
upload_sources: true
# Upload translations to Crowdin, only use true at initial run
upload_translations: true
# Download translations from Crowdin
download_translations: true
# Create a pull request with new translations
create_pull_request: true
pull_request_title: 'New Crowdin Translations'
pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)'
pull_request_base_branch_name: main
localization_branch_name: l10n_crowdin_translations
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

12
crowdin.yml Normal file
View file

@ -0,0 +1,12 @@
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
"base_path": "."
"preserve_hierarchy": true
"files": [
{
"source": "locales/en.yml",
"translation": "locales/%two_letters_code%.yml"
}
]