Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #319 from shafin-deriv/shafin/DAPI-546/feat--trans…
Browse files Browse the repository at this point in the history
…lation-workflows

[DAPI] feat: crowdin translation workflows
  • Loading branch information
sandeep-deriv authored Apr 30, 2024
2 parents 2bf0220 + 084aa61 commit 134ab21
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .github/actions/test_build/action.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/translation_pull.yml
Original file line number Diff line number Diff line change
@@ -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 }}
23 changes: 23 additions & 0 deletions .github/workflows/translation_push.yml
Original file line number Diff line number Diff line change
@@ -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 }}
23 changes: 23 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit 134ab21

Please sign in to comment.