From a8af73be871b7fbb8a72016ecd9ff754a237bcc2 Mon Sep 17 00:00:00 2001 From: loganhz Date: Fri, 13 Oct 2017 20:38:04 +0800 Subject: [PATCH] Add the script for updating i18n files https://github.com/rancher/rancher/issues/10078 --- crowdin.yml | 43 +++++++++++++++++++++---------------- scripts/update-translations | 21 ++++++++++++++++++ 2 files changed, 45 insertions(+), 19 deletions(-) create mode 100755 scripts/update-translations diff --git a/crowdin.yml b/crowdin.yml index a5eda4f74..2e06afca6 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,24 +1,29 @@ api_key_env: CROWDIN_API_KEY project_identifier: rancher-ui -base_path: /source +base_path: /translations preserve_hierarchy: false files: -- source: "/translations/en-us.yaml" - dest: "/ui.yaml" - translation: "/translations/%locale%.yaml" - ignore: - - "*.md" - type: yaml - update_option: update_as_unapproved - languages_mapping: - locale: - de-DE: de-de - en-US: en-us - fa-IR: fa-ir - fr-FR: fr-fr - ja-JP: ja-jp - pt-BR: pt-br - ru-RU: u-ru - uk-UA: uk-ua - zh-CN: zh-hans + - source: en-us.yaml + dest: /ui.yaml + translation: '%locale%.yaml' + type: yaml + update_option: update_as_unapproved + languages_mapping: + locale: + de-DE: de-de + en-US: en-us + es-ES: es-es + fa-IR: fa-ir + fr-FR: fr-fr + it-IT: it-it + ja-JP: ja-jp + hu-HU: hu-hu + ko-KR: ko-kr + nb-NO: nb-no + nl-NL: nl-nl + pt-BR: pt-br + ru-RU: ru-ru + sv-SE: sv-se + zh-CN: zh-hans + zh-TW: zh-hant diff --git a/scripts/update-translations b/scripts/update-translations new file mode 100755 index 000000000..66f13d4a4 --- /dev/null +++ b/scripts/update-translations @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +# cd to app root +CWD=$(dirname $0) +if [[ `basename $(pwd)` = 'scripts' ]]; then + cd ../ +else + cd `dirname $CWD` +fi + +if [[ ! "${CROWDIN_API_KEY}" ]]; then + echo Please setup CROWDIN_API_KEY + exit 1 +fi + +docker run -e CROWDIN_API_KEY \ + -e PROJECT_IDENTIFIER=rancher-ui \ + -v $(pwd)/translations:/translations \ + -v $(pwd)/crowdin.yml:/opt/translations/crowdin.yml \ + loganhz/crowdin-tool:v0.0.1 \