diff --git a/.github/actions/test_build/action.yml b/.github/actions/test_build/action.yml new file mode 100644 index 00000000..44e59998 --- /dev/null +++ b/.github/actions/test_build/action.yml @@ -0,0 +1,19 @@ +name: build +description: Build Docusaurus project +inputs: + NODE_ENV: + description: Node environment + required: false + default: staging + TRACKJS_TOKEN: + description: Trackjs Token + required: false +runs: + using: composite + steps: + - name: Building Docusaurus project + env: + NODE_ENV: ${{ inputs.NODE_ENV }} + TRACKJS_TOKEN: ${{ inputs.TRACKJS_TOKEN }} + run: npm run build -- --locale en + shell: bash diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index d0f16ffd..4c56e6f3 100755 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies uses: './.github/actions/npm_install_from_cache' - name: Build - uses: ./.github/actions/build + uses: ./.github/actions/test_build - name: Run Tests run: npm run test -- --collectCoverage - name: Coveralls diff --git a/.github/workflows/translation_pull.yml b/.github/workflows/translation_pull.yml new file mode 100644 index 00000000..8350be6d --- /dev/null +++ b/.github/workflows/translation_pull.yml @@ -0,0 +1,30 @@ +name: Crowdin Action + +on: + workflow_dispatch: + +permissions: write-all + +jobs: + crowdin: + runs-on: ubuntu-latest + environment: production + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Synchronize with Crowdin + uses: crowdin/github-action@v1 + with: + upload_sources: false + upload_translations: false + download_translations: true + localization_branch_name: l18n_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: 'master' + env: + GITHUB_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.github/workflows/translation_push.yml b/.github/workflows/translation_push.yml new file mode 100644 index 00000000..80b5a5da --- /dev/null +++ b/.github/workflows/translation_push.yml @@ -0,0 +1,23 @@ +name: Crowdin Action + +on: + push: + paths: ['i18n/**'] + branches: [master] + +jobs: + crowdin-upload: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Crowdin push + uses: crowdin/github-action@v1 + 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 }} diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 00000000..7673d6b2 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,23 @@ +project_id: 'CROWDIN_PROJECT_ID' +api_token: 'CROWDIN_PERSONAL_TOKEN' +base_path: '.' +base_url: 'https://api.crowdin.com' +preserve_hierarchy: true + +files: + # JSON translation files + - source: /i18n/en/**/* + translation: /i18n/%two_letters_code%/**/%original_file_name% + languages_mapping: + two_letters_code: + en: en + es-ES: es_ES + fr-FR: fr_FR + # Docs Markdown files + - source: /docs/**/* + translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name% + languages_mapping: + two_letters_code: + en: en + es-ES: es_ES + fr-FR: fr_FR diff --git a/docusaurus.config.js b/docusaurus.config.js index 763a13a7..e2ee9d03 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -27,7 +27,12 @@ const config = { // to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', - locales: ['en'], + locales: ['en', 'es', 'fr'], + localeConfigs: { + en: { + label: 'English', + }, + }, }, plugins: [