Skip to content

Commit

Permalink
Add Crowdin Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitrrine committed Aug 29, 2024
1 parent c44d1fd commit 0d1ab61
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/crowdin-download.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Download Crowdin Translations

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Synchronize with Crowdin
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_translations: true
localization_branch_name: l10n_crowdin_translations

create_pull_request: true
pull_request_title: "New Crowdin translations"
pull_request_body: "New Crowdin pull request with translations"
pull_request_base_branch_name: "main"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/crowdin-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Upload Crowdin Sources

on:
push:
paths: ["html/i18n/**"]
branches: [main]

jobs:
crowdin-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Crowdin push
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: true
download_translations: false
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
15 changes: 13 additions & 2 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
"base_path": "."
"base_url": "https://api.crowdin.com"

"preserve_hierarchy": true

files:
- source: /html/i18n/en.json
translation: /%original_path%/%two_letters_code%.json
[
{
"source": "/html/i18n/en.json",
"translation": "/html/i18n/%two_letters_code%.json",
},
]

0 comments on commit 0d1ab61

Please sign in to comment.