From be6ecfbfe9391e1b85af4a5e6f2ef7c4f2183d01 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 14:01:48 +0200 Subject: [PATCH 01/10] feat: crowdin integration --- .github/workflows/github-to-crowdin.yml | 26 ++++++++++++++++++++++++ crowdin.yml | 27 +++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/github-to-crowdin.yml create mode 100644 crowdin.yml diff --git a/.github/workflows/github-to-crowdin.yml b/.github/workflows/github-to-crowdin.yml new file mode 100644 index 000000000..b21c6b512 --- /dev/null +++ b/.github/workflows/github-to-crowdin.yml @@ -0,0 +1,26 @@ +name: GitHub To Crowdin + +on: + push: + branches: [ crowdin-i18n ] + +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: true + 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 }} diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 000000000..945c3868a --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,27 @@ +# +# 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 +# +"preserve_hierarchy": true + +# +# Files configuration +# +files: [ + { + "source": "**/*.i18n.en-us.js", + "translation": "%original_path%/%file_name%.i18n.%locale%.js", + }, + { + "source": "/src/i18n/translations/en-us/global.js", + "translation": "/src/i18n/translations/%locale%/global.js" + } +] From 728ed90ca29e5bb5419a0fea59f82bbc2c95e90b Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 14:16:47 +0200 Subject: [PATCH 02/10] fix: adjust translation file --- crowdin.yml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/crowdin.yml b/crowdin.yml index 945c3868a..fd3930903 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -19,9 +19,39 @@ files: [ { "source": "**/*.i18n.en-us.js", "translation": "%original_path%/%file_name%.i18n.%locale%.js", + 'languages_mapping': { + 'locale': + { + 'cs-CZ': 'cs-cz', + 'de-DE': 'de-de', + 'fr-FR': 'fr-fr', + 'hu-HU': 'hu-hu', + 'it-IT': 'it-it', + 'pt-BR': 'pt-br', + 'ro-RO': 'ro-ro', + 'es-ES': 'es-es', + }, + }, + "translation_replace": { + ".i18n.en-us": "" + } }, { "source": "/src/i18n/translations/en-us/global.js", - "translation": "/src/i18n/translations/%locale%/global.js" + "translation": "/src/i18n/translations/%locale%/global.js", + 'languages_mapping': { + 'locale': + { + 'cs-CZ': 'cs-cz', + 'de-DE': 'de-de', + 'fr-FR': 'fr-fr', + 'hu-HU': 'hu-hu', + 'it-IT': 'it-it', + 'pt-BR': 'pt-br', + 'ro-RO': 'ro-ro', + 'es-ES': 'es-es', + }, + } } + ] From dda01899f0632dd4feede8c7f8aa38fd9561856e Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 14:26:28 +0200 Subject: [PATCH 03/10] fix: replace ' with " --- crowdin.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/crowdin.yml b/crowdin.yml index fd3930903..ba45b11f7 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -19,17 +19,17 @@ files: [ { "source": "**/*.i18n.en-us.js", "translation": "%original_path%/%file_name%.i18n.%locale%.js", - 'languages_mapping': { - 'locale': + "languages_mapping": { + "locale": { - 'cs-CZ': 'cs-cz', - 'de-DE': 'de-de', - 'fr-FR': 'fr-fr', - 'hu-HU': 'hu-hu', - 'it-IT': 'it-it', - 'pt-BR': 'pt-br', - 'ro-RO': 'ro-ro', - 'es-ES': 'es-es', + "cs-CZ": "cs-cz", + "de-DE": "de-de", + "fr-FR": "fr-fr", + "hu-HU": "hu-hu", + "it-IT": "it-it", + "pt-BR": "pt-br", + "ro-RO": "ro-ro", + "es-ES": "es-es", }, }, "translation_replace": { @@ -39,17 +39,17 @@ files: [ { "source": "/src/i18n/translations/en-us/global.js", "translation": "/src/i18n/translations/%locale%/global.js", - 'languages_mapping': { - 'locale': + "languages_mapping": { + "locale": { - 'cs-CZ': 'cs-cz', - 'de-DE': 'de-de', - 'fr-FR': 'fr-fr', - 'hu-HU': 'hu-hu', - 'it-IT': 'it-it', - 'pt-BR': 'pt-br', - 'ro-RO': 'ro-ro', - 'es-ES': 'es-es', + "cs-CZ": "cs-cz", + "de-DE": "de-de", + "fr-FR": "fr-fr", + "hu-HU": "hu-hu", + "it-IT": "it-it", + "pt-BR": "pt-br", + "ro-RO": "ro-ro", + "es-ES": "es-es", }, } } From aa9ea0694e0aca4d678945f0ea230d61f75cbe30 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 14:33:27 +0200 Subject: [PATCH 04/10] fix: use internal crowdin language code --- crowdin.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crowdin.yml b/crowdin.yml index ba45b11f7..401bba0bd 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -22,13 +22,13 @@ files: [ "languages_mapping": { "locale": { - "cs-CZ": "cs-cz", - "de-DE": "de-de", - "fr-FR": "fr-fr", - "hu-HU": "hu-hu", - "it-IT": "it-it", + "cs": "cs-cz", + "de": "de-de", + "fr": "fr-fr", + "hu": "hu-hu", + "it": "it-it", "pt-BR": "pt-br", - "ro-RO": "ro-ro", + "ro": "ro-ro", "es-ES": "es-es", }, }, @@ -42,13 +42,13 @@ files: [ "languages_mapping": { "locale": { - "cs-CZ": "cs-cz", - "de-DE": "de-de", - "fr-FR": "fr-fr", - "hu-HU": "hu-hu", - "it-IT": "it-it", + "cs": "cs-cz", + "de": "de-de", + "fr": "fr-fr", + "hu": "hu-hu", + "it": "it-it", "pt-BR": "pt-br", - "ro-RO": "ro-ro", + "ro": "ro-ro", "es-ES": "es-es", }, } From dfd729dcdad70dbf8d50baa86736353f61f88c57 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 14:48:27 +0200 Subject: [PATCH 05/10] feat: add crowdin to github flow --- .github/workflows/crowdin-to-github.yml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/crowdin-to-github.yml diff --git a/.github/workflows/crowdin-to-github.yml b/.github/workflows/crowdin-to-github.yml new file mode 100644 index 000000000..8f9738343 --- /dev/null +++ b/.github/workflows/crowdin-to-github.yml @@ -0,0 +1,31 @@ +name: Crowdin To GitHub + +on: + workflow_dispatch: + schedule: + - cron: '15 * * * *' # sync 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 }} From fd57b52f36c608ef0efe4ea89f7e36cc6edb63d4 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 14:50:12 +0200 Subject: [PATCH 06/10] fix: add on push --- .github/workflows/crowdin-to-github.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/crowdin-to-github.yml b/.github/workflows/crowdin-to-github.yml index 8f9738343..72d507d18 100644 --- a/.github/workflows/crowdin-to-github.yml +++ b/.github/workflows/crowdin-to-github.yml @@ -2,6 +2,8 @@ name: Crowdin To GitHub on: workflow_dispatch: + push: + branches: [ crowdin-i18n ] schedule: - cron: '15 * * * *' # sync every hour From c58d8710ac7195885a6e0437df7a49a4f4aaa5c1 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 15:13:42 +0200 Subject: [PATCH 07/10] feat: add thai to local mapping --- crowdin.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crowdin.yml b/crowdin.yml index 401bba0bd..f01898512 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -30,6 +30,7 @@ files: [ "pt-BR": "pt-br", "ro": "ro-ro", "es-ES": "es-es", + "th": "th-th" }, }, "translation_replace": { @@ -50,6 +51,7 @@ files: [ "pt-BR": "pt-br", "ro": "ro-ro", "es-ES": "es-es", + "th": "th-th" }, } } From b8ff19ead998aaf4c662c4e1e89cecc649ce22e5 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 15:14:35 +0200 Subject: [PATCH 08/10] feat: remove push --- .github/workflows/crowdin-to-github.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/crowdin-to-github.yml b/.github/workflows/crowdin-to-github.yml index 72d507d18..8f9738343 100644 --- a/.github/workflows/crowdin-to-github.yml +++ b/.github/workflows/crowdin-to-github.yml @@ -2,8 +2,6 @@ name: Crowdin To GitHub on: workflow_dispatch: - push: - branches: [ crowdin-i18n ] schedule: - cron: '15 * * * *' # sync every hour From 37386358e02cd104b9d9548c666fee1812392d85 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 15:31:12 +0200 Subject: [PATCH 09/10] feat: prepare for merge in main --- .github/workflows/github-to-crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-to-crowdin.yml b/.github/workflows/github-to-crowdin.yml index b21c6b512..bdca12583 100644 --- a/.github/workflows/github-to-crowdin.yml +++ b/.github/workflows/github-to-crowdin.yml @@ -16,7 +16,7 @@ jobs: uses: crowdin/github-action@v1.19.0 with: upload_sources: true - upload_translations: true + upload_translations: false download_translations: false create_pull_request: false localization_branch_name: i18n_crowdin From 66a622f3c1c0af8658a6e0be66da12ad16791e85 Mon Sep 17 00:00:00 2001 From: jstier Date: Tue, 16 Apr 2024 15:57:18 +0200 Subject: [PATCH 10/10] feat: prepare for push in main --- .github/workflows/github-to-crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-to-crowdin.yml b/.github/workflows/github-to-crowdin.yml index bdca12583..93f945540 100644 --- a/.github/workflows/github-to-crowdin.yml +++ b/.github/workflows/github-to-crowdin.yml @@ -2,7 +2,7 @@ name: GitHub To Crowdin on: push: - branches: [ crowdin-i18n ] + branches: [ main ] jobs: synchronize-with-crowdin: