Automating translations updates (#2218)

* Automatically push new strings to cutter-translations
This commit is contained in:
xarkes 2020-10-10 20:00:34 +02:00 committed by GitHub
parent d971f30d25
commit 1cbbc45678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 38 deletions

View File

@ -90,7 +90,7 @@ matrix:
brewfile: scripts/Brewfile brewfile: scripts/Brewfile
update: true # updating brew to get slightly newer meson, 0.54 doesn't work on macOS. update: true # updating brew to get slightly newer meson, 0.54 doesn't work on macOS.
- name: Documentation + Deploy - name: Documentation + Translations + Deploy
os: linux os: linux
cache: ~ cache: ~
addons: addons:
@ -113,17 +113,19 @@ matrix:
before_deploy: before_deploy:
- cd "$TRAVIS_BUILD_DIR" - cd "$TRAVIS_BUILD_DIR"
- openssl aes-256-cbc -K $encrypted_bd0ed4c1fd75_key -iv $encrypted_bd0ed4c1fd75_iv -in scripts/deploy_docs_rsa.enc -out scripts/deploy_docs_rsa -d - openssl aes-256-cbc -K $encrypted_bd0ed4c1fd75_key -iv $encrypted_bd0ed4c1fd75_iv -in scripts/deploy_docs_rsa.enc -out scripts/deploy_docs_rsa -d
- openssl aes-256-cbc -K $encrypted_df6d16737705c_key -iv $encrypted_df6d16737705c_iv -in scripts/deploy_translations_rsa.enc -out scripts/deploy_translations_rsa -d
- chmod 600 scripts/deploy_docs_rsa - chmod 600 scripts/deploy_docs_rsa
- chmod 600 scripts/deploy_translations_rsa
- export GIT_SSH_COMMAND="/usr/bin/ssh -i $TRAVIS_BUILD_DIR/scripts/deploy_docs_rsa" - export GIT_SSH_COMMAND="/usr/bin/ssh -i $TRAVIS_BUILD_DIR/scripts/deploy_docs_rsa"
- git config --global user.name "Travis CI" - git config --global user.name "Travis CI"
- git config --global user.email "travis@travis-ci.com" - git config --global user.email "travis@travis-ci.com"
deploy: deploy:
skip_cleanup: true skip_cleanup: true
provider: script provider: script
script: bash scripts/deploy_docs.sh script: bash -c "./scripts/deploy_docs.sh; ./scripts/deploy_translations.sh"
on: on:
repo: radareorg/cutter repo: radareorg/cutter
branch: master branch: translate
sudo: required sudo: required
@ -229,6 +231,7 @@ script:
fi fi
after_success: after_success:
# Do the release
- export CUTTER_VERSION=$(python ../scripts/get_version.py) - export CUTTER_VERSION=$(python ../scripts/get_version.py)
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
lrelease ../src/Cutter.pro && lrelease ../src/Cutter.pro &&

21
scripts/deploy_translations.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
#######################
#### Push new translation files
# Update submodule
cd ${TRAVIS_BUILD_DIR}/src
git submodule update translations
cd translations
git pull origin master
# Generate Crowdin single translation file from cutter_fr.ts
lupdate ../Cutter.pro
cp ./fr/cutter_fr_FR.ts ./Translations.ts
# Push it so Crowdin can find new strings, and later push updated translations
git add Translations.ts
git commit -m "Updated translations"
export GIT_SSH_COMMAND="/usr/bin/ssh -i $TRAVIS_BUILD_DIR/scripts/deploy_translations_rsa"
echo "Pushing new translation strings..."
git push "git@github.com:radareorg/cutter-translations.git" HEAD:refs/heads/master

Binary file not shown.

View File

@ -11,22 +11,25 @@ VERSION = $${CUTTER_VERSION_MAJOR}.$${CUTTER_VERSION_MINOR}.$${CUTTER_VERSION_PA
# Required QT version # Required QT version
lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5") lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5")
TRANSLATIONS += translations/cutter_ar.ts \ TRANSLATIONS += translations/ar/cutter_ar.ts \
translations/cutter_ca.ts \ translations/ca/cutter_ca.ts \
translations/cutter_cn.ts \ translations/de/cutter_de.ts \
translations/cutter_de.ts \ translations/es-ES/cutter_es.ts \
translations/cutter_es.ts \ translations/fa/cutter_fa.ts \
translations/cutter_fa.ts \ translations/fr/cutter_fr.ts \
translations/cutter_fr.ts \ translations/he/cutter_he.ts \
translations/cutter_he.ts \ translations/hi/cutter_hi.ts \
translations/cutter_hi.ts \ translations/it/cutter_it.ts \
translations/cutter_it.ts \ translations/ja/cutter_ja.ts \
translations/cutter_ja.ts \ translations/nl/cutter_nl.ts \
translations/cutter_nl.ts \ translations/pt-PT/cutter_pt.ts \
translations/cutter_pt.ts \ translations/ro/cutter_ro.ts \
translations/cutter_ro.ts \ translations/ru/cutter_ru.ts \
translations/cutter_ru.ts \ translations/tr/cutter_tr.ts \
translations/cutter_tr.ts translations/zh-CN/cutter_zh.ts
# translations/ko/cutter_ko.ts problems with fonts
# translations/pt-BR/cutter_pt.ts #2321 handling multiple versions of a language
# Icon for OS X # Icon for OS X
ICON = img/cutter.icns ICON = img/cutter.icns

View File

@ -1,23 +1,23 @@
set(TS_FILES set(TS_FILES
translations/cutter_ar.ts translations/ar/cutter_ar.ts
translations/cutter_ca.ts translations/ca/cutter_ca.ts
translations/cutter_cn.ts translations/de/cutter_de.ts
translations/cutter_de.ts translations/es-ES/cutter_es.ts
translations/cutter_es.ts translations/fa/cutter_fa.ts
translations/cutter_fa.ts translations/fr/cutter_fr.ts
translations/cutter_fr.ts translations/he/cutter_he.ts
translations/cutter_he.ts translations/hi/cutter_hi.ts
translations/cutter_hi.ts translations/it/cutter_it.ts
translations/cutter_it.ts translations/ja/cutter_ja.ts
translations/cutter_ja.ts translations/nl/cutter_nl.ts
translations/cutter_nl.ts translations/pt-PT/cutter_pt.ts
translations/cutter_pt.ts translations/ro/cutter_ro.ts
translations/cutter_ro.ts translations/ru/cutter_ru.ts
translations/cutter_ru.ts translations/tr/cutter_tr.ts
translations/cutter_tr.ts translations/zh-CN/cutter_zh.ts
) )
# translations/cutter_ko.ts problems with fonts # translations/ko/cutter_ko.ts problems with fonts
# translations/cutter_pt-BR #2321 handling multiple versions of a language # translations/pt-BR/cutter_pt.ts #2321 handling multiple versions of a language
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translations) set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translations)
find_package(Qt5LinguistTools REQUIRED) find_package(Qt5LinguistTools REQUIRED)

@ -1 +1 @@
Subproject commit 7b0dd0675ba51e45106a2a188b8c01608953ffdc Subproject commit 8e1d24b4040474c681d8db39cb75c0ed66bb5bda