-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(i18n): [MTM-62062] Add translation workflow (#59)
Signed-off-by: Paweł Rynarzewski <[email protected]>
- Loading branch information
1 parent
4cdde24
commit adb80a9
Showing
4 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Handle translations | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: Branch to handle translations for. | ||
required: false | ||
default: main | ||
|
||
jobs: | ||
handle_translations: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get GitHub token for c8y-i18n-automations app | ||
id: i18n-automations-token | ||
uses: Cumulocity-IoT/github-app-token@v3 | ||
with: | ||
app_id: ${{ vars.C8Y_I18N_APP_ID }} | ||
installation_id: ${{ vars.C8Y_I18N_INSTALLATION_ID }} | ||
private_key: ${{ secrets.C8Y_I18N_PRIVATE_KEY }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.branch }} | ||
token: ${{ steps.i18n-automations-token.outputs.token }} | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Extract source files | ||
run: ng extract-i18n | ||
|
||
- name: Run i18n-automation action | ||
id: i18n-automation | ||
uses: Cumulocity-IoT/i18n-automation@main | ||
env: | ||
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }} | ||
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} | ||
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }} | ||
GITHUB_TOKEN: ${{ steps.i18n-automations-token.outputs.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,6 @@ Thumbs.db | |
|
||
# Cypress videos | ||
cypress/videos | ||
|
||
# Exclude auto-generated locale files | ||
/locales |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
project_id_env: "CROWDIN_PROJECT_ID" | ||
api_token_env: "CROWDIN_API_TOKEN" | ||
|
||
preserve_hierarchy: false | ||
|
||
files: [ | ||
{ | ||
"source": "/locales/locales.pot", | ||
"translation": "/src/locales/%locale_with_underscore%.po", | ||
|
||
"languages_mapping": { | ||
"locale_with_underscore": { | ||
"de": "de", | ||
"es-ES": "es", | ||
"fr": "fr", | ||
"ja": "ja_JP", | ||
"ko": "ko", | ||
"nl": "nl", | ||
"pl": "pl", | ||
"pt-BR": "pt_BR", | ||
"zh-CN": "zh_CN", | ||
"zh-TW": "zh_TW" | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters