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

[DAPI] chore: Translation draft #318

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_download.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
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Synchronize with Crowdin
uses: crowdin/github-action@v1
with:
upload_sources: false
upload_translations: false
download_translations: true
localization_branch_name: l10n_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: 'main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/translation_upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Crowdin Action

on:
push:
paths: ['i18n/**']
branches: [main]

jobs:
crowdin-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- 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_env: 'CROWDIN_PROJECT_ID'
api_token_env: '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
2 changes: 1 addition & 1 deletion docs/core-concepts/authorization-authentication/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Please make sure you have all the requirements mentioned below to continue.
3. Deriv app ID

:::note
Please refer to [Setting up a Deriv application](docs/setting-up-a-deriv-application.md) for detailed instructions on how to create a Deriv API token and application.
Please refer to [Setting up a Deriv application](/docs/setting-up-a-deriv-application) for detailed instructions on how to create a Deriv API token and application.
:::

### API token
Expand Down
13 changes: 11 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config = {
organizationName: 'binary-com', // Usually your GitHub org/user name.
projectName: 'deriv-api-docs', // Usually your repo name.
trailingSlash: false,

onBrokenLinks: 'ignore',
customFields: {
trackJsToken: process.env.TRACKJS_TOKEN,
},
Expand All @@ -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 Expand Up @@ -118,6 +123,10 @@ const config = {
type: 'custom-user-navbar-item',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
prism: {
Expand Down
Loading
Loading