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

Commit 134ab21

Browse files
Merge pull request #319 from shafin-deriv/shafin/DAPI-546/feat--translation-workflows
[DAPI] feat: crowdin translation workflows
2 parents 2bf0220 + 084aa61 commit 134ab21

File tree

6 files changed

+102
-2
lines changed

6 files changed

+102
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: build
2+
description: Build Docusaurus project
3+
inputs:
4+
NODE_ENV:
5+
description: Node environment
6+
required: false
7+
default: staging
8+
TRACKJS_TOKEN:
9+
description: Trackjs Token
10+
required: false
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Building Docusaurus project
15+
env:
16+
NODE_ENV: ${{ inputs.NODE_ENV }}
17+
TRACKJS_TOKEN: ${{ inputs.TRACKJS_TOKEN }}
18+
run: npm run build -- --locale en
19+
shell: bash

.github/workflows/coveralls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install dependencies
1919
uses: './.github/actions/npm_install_from_cache'
2020
- name: Build
21-
uses: ./.github/actions/build
21+
uses: ./.github/actions/test_build
2222
- name: Run Tests
2323
run: npm run test -- --collectCoverage
2424
- name: Coveralls
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Crowdin Action
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions: write-all
7+
8+
jobs:
9+
crowdin:
10+
runs-on: ubuntu-latest
11+
environment: production
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
15+
16+
- name: Synchronize with Crowdin
17+
uses: crowdin/github-action@v1
18+
with:
19+
upload_sources: false
20+
upload_translations: false
21+
download_translations: true
22+
localization_branch_name: l18n_crowdin_translations
23+
create_pull_request: true
24+
pull_request_title: 'New Crowdin translations'
25+
pull_request_body: 'New Crowdin pull request with translations'
26+
pull_request_base_branch_name: 'master'
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
29+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
30+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Crowdin Action
2+
3+
on:
4+
push:
5+
paths: ['i18n/**']
6+
branches: [master]
7+
8+
jobs:
9+
crowdin-upload:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
14+
15+
- name: Crowdin push
16+
uses: crowdin/github-action@v1
17+
with:
18+
upload_sources: true
19+
upload_translations: true
20+
download_translations: false
21+
env:
22+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
23+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

crowdin.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
project_id: 'CROWDIN_PROJECT_ID'
2+
api_token: 'CROWDIN_PERSONAL_TOKEN'
3+
base_path: '.'
4+
base_url: 'https://api.crowdin.com'
5+
preserve_hierarchy: true
6+
7+
files:
8+
# JSON translation files
9+
- source: /i18n/en/**/*
10+
translation: /i18n/%two_letters_code%/**/%original_file_name%
11+
languages_mapping:
12+
two_letters_code:
13+
en: en
14+
es-ES: es_ES
15+
fr-FR: fr_FR
16+
# Docs Markdown files
17+
- source: /docs/**/*
18+
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
19+
languages_mapping:
20+
two_letters_code:
21+
en: en
22+
es-ES: es_ES
23+
fr-FR: fr_FR

docusaurus.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ const config = {
2727
// to replace "en" with "zh-Hans".
2828
i18n: {
2929
defaultLocale: 'en',
30-
locales: ['en'],
30+
locales: ['en', 'es', 'fr'],
31+
localeConfigs: {
32+
en: {
33+
label: 'English',
34+
},
35+
},
3136
},
3237

3338
plugins: [

0 commit comments

Comments
 (0)