Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: crowdin integration #415

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/crowdin-to-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Crowdin To GitHub

on:
workflow_dispatch:
schedule:
- cron: '15 * * * *' # sync every hour
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's enough to run this once a day, as the changes aren't released that fast anyway. Or would there be a reason to do this every hour?


jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Sync Crowdin to Github
uses: crowdin/github-action@v1.19.0
with:
upload_sources: false
upload_translations: false
download_translations: true
localization_branch_name: i18n_crowdin
create_pull_request: true
push_sources: false
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'
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
26 changes: 26 additions & 0 deletions .github/workflows/github-to-crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: GitHub To Crowdin

on:
push:
branches: [ main ]

jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Sync GH and Crowdin
uses: crowdin/github-action@v1.19.0
with:
upload_sources: true
upload_translations: false
download_translations: false
create_pull_request: false
localization_branch_name: i18n_crowdin
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
59 changes: 59 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# Your Crowdin credentials
#
Comment on lines +1 to +3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#
# Your Crowdin credentials
#

"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
"base_path": "."
"base_url": "https://api.crowdin.com"

#
# Choose file structure in Crowdin
# e.g. true or false
#
Comment on lines +8 to +12
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#
# Choose file structure in Crowdin
# e.g. true or false
#
# preserve file/folder structure in Crowdin

"preserve_hierarchy": true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would false look like in crowdin?
Would it still have the file names but all next to each other?
I think that would make it a bit easier for translating, if it's mapped back to the repo properly


#
# Files configuration
#
Comment on lines +14 to +17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#
# Files configuration
#

files: [
{
"source": "**/*.i18n.en-us.js",
"translation": "%original_path%/%file_name%.i18n.%locale%.js",
"languages_mapping": {
"locale":
{
"cs": "cs-cz",
"de": "de-de",
"fr": "fr-fr",
"hu": "hu-hu",
"it": "it-it",
"pt-BR": "pt-br",
"ro": "ro-ro",
"es-ES": "es-es",
"th": "th-th"
},
},
"translation_replace": {
".i18n.en-us": ""
}
},
{
"source": "/src/i18n/translations/en-us/global.js",
"translation": "/src/i18n/translations/%locale%/global.js",
"languages_mapping": {
"locale":
{
"cs": "cs-cz",
"de": "de-de",
"fr": "fr-fr",
"hu": "hu-hu",
"it": "it-it",
"pt-BR": "pt-br",
"ro": "ro-ro",
"es-ES": "es-es",
"th": "th-th"
},
}
}

]