From b07a9116b6b532649a01c56dd775ae1ea4aba261 Mon Sep 17 00:00:00 2001 From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Date: Sun, 31 Jan 2021 01:18:52 -0700 Subject: [PATCH] feat: use crowdin for client ui translations (#40841) --- .../crowdin-i18n-client-ui-download.yml | 49 +++++++++++++++++++ .../crowdin-i18n-client-ui-upload.yml | 40 +++++++++++++++ client/i18n/locales/crowdin.yml | 17 +++++++ 3 files changed, 106 insertions(+) create mode 100644 .github/workflows/crowdin-i18n-client-ui-download.yml create mode 100644 .github/workflows/crowdin-i18n-client-ui-upload.yml create mode 100644 client/i18n/locales/crowdin.yml diff --git a/.github/workflows/crowdin-i18n-client-ui-download.yml b/.github/workflows/crowdin-i18n-client-ui-download.yml new file mode 100644 index 0000000000..afd8fd69b8 --- /dev/null +++ b/.github/workflows/crowdin-i18n-client-ui-download.yml @@ -0,0 +1,49 @@ +name: Crowdin Client UI Download +on: + workflow_dispatch: + +jobs: + + i18n-download-client-ui-translations: + name: Client + runs-on: ubuntu-18.04 + + steps: + - name: Checkout Source Files + uses: actions/checkout@v2 + + - name: Crowdin Download + uses: crowdin/github-action@master + # options: https://github.com/crowdin/github-action/blob/master/action.yml + with: + # uploads + upload_sources: false + upload_translations: false + auto_approve_imported: false + import_eq_suggestions: false + + # downloads + download_translations: true + skip_untranslated_files: true + export_only_approved: true + + commit_message: 'chore(i8n,client): processed translations' + + # pull-request + localization_branch_name: i18n-sync-client-processed-translations + create_pull_request: false + pull_request_title: 'chore(i18n,client): Processed translations from crowdin' + pull_request_body: '' + pull_request_labels: 'scope: i18n, platform: client, crowdin-sync' + + # global options + config: './client/i18n/locales/crowdin.yml' + base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} + + # Uncomment below to debug + # dryrun_action: true + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CLIENT }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }} diff --git a/.github/workflows/crowdin-i18n-client-ui-upload.yml b/.github/workflows/crowdin-i18n-client-ui-upload.yml new file mode 100644 index 0000000000..c6e402ce39 --- /dev/null +++ b/.github/workflows/crowdin-i18n-client-ui-upload.yml @@ -0,0 +1,40 @@ +name: Crowdin Client UI Upload +on: + workflow_dispatch: + +jobs: + + i18n-upload-client-ui-files: + name: Client + runs-on: ubuntu-18.04 + + steps: + - name: Checkout Source Files + uses: actions/checkout@v2 + - name: Crowdin Upload + uses: crowdin/github-action@master + # options: https://github.com/crowdin/github-action/blob/master/action.yml + with: + # uploads + upload_sources: true + upload_translations: true + auto_approve_imported: false + import_eq_suggestions: false + + # downloads + download_translations: false + + # pull-request + create_pull_request: false + + # global options + config: './client/i18n/locales/crowdin.yml' + base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} + + # Uncomment below to debug + # dryrun_action: true + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CLIENT }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }} diff --git a/client/i18n/locales/crowdin.yml b/client/i18n/locales/crowdin.yml new file mode 100644 index 0000000000..f5dfdd07f0 --- /dev/null +++ b/client/i18n/locales/crowdin.yml @@ -0,0 +1,17 @@ +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path_env": "CROWDIN_BASE_PATH" +"base_url_env": "CROWDIN_BASE_URL" + +"preserve_hierarchy": true + +files: [ + { + "source" : "/client/i18n/locales/english/intro.json", + "translation" : "/client/i18n/locales/%language%/%original_file_name%" + }, + { + "source" : "/client/i18n/locales/english/translations.json", + "translation" : "/client/i18n/locales/%language%/%original_file_name%" + } +]