From c1245190288347c3abe8e34e86464d935cf2dc61 Mon Sep 17 00:00:00 2001 From: danielevalverde Date: Mon, 1 Sep 2025 17:17:28 -0300 Subject: [PATCH 1/3] Improve translation update script with service/action support --- bin/update-l10n.sh | 121 +++++++++++++++++++++++++++++++-------------- 1 file changed, 84 insertions(+), 37 deletions(-) diff --git a/bin/update-l10n.sh b/bin/update-l10n.sh index d99bb46..3ed6fa2 100755 --- a/bin/update-l10n.sh +++ b/bin/update-l10n.sh @@ -1,38 +1,85 @@ #!/bin/bash -cd check-api && git checkout develop && git pull && cd - && \ -cd check-web && git checkout develop && git pull && cd - && \ -# cd check-mark && git checkout develop && git pull && cd - && \ -# cd check-search && git checkout develop && git pull && cd - && \ - -echo 'Updating Check API translations...' && \ -(docker compose exec api /tx push) && \ -(docker compose exec api /tx pull) && \ -# FIXME: Configure check-tiplines resource pulling -# (docker-compose exec api bundle exec rake transifex:download_tipline) && \ - -echo 'Updating Check Web translations...' && \ -(docker compose exec web npm run transifex:merge-source) && \ -(docker compose exec web /tx push) && \ -(docker compose exec web /tx pull) && \ -(docker compose exec web npm run transifex:merge-translated) && \ - -# echo 'Updating Check Mark translations...' && \ -# (docker-compose exec mark npm run transifex:upload) && \ -# (docker-compose exec mark npm run transifex:download) && \ - -# echo 'Updating Check Search translations...' && \ -# (docker-compose exec search npm run transifex:upload) && \ -# (docker-compose exec search npm run transifex:download) && \ - -echo 'Done! Please check the changes below:' && \ -echo 'Check API:' && cd check-api && git status && cd - && \ -echo 'Check Web:' && cd check-web && git status && cd - && \ -# echo 'Check Mark:' && cd check-mark && git status && cd - && \ -# echo 'Check Search:' && cd check-search && git status && cd - && \ - -# It's safer to run the ones below manually: -echo 'Should be all updated - if it looks good to you, please push to `develop`:' && \ -echo "cd check-api && git commit config/locales -m 'CHECK-109: Updating l10n' && git push && cd -" # && \ -echo "cd check-web && git commit localization -m 'CHECK-109: Updating l10n' && git push && cd -" && \ -# echo "cd check-mark && git commit src/localization -m 'CHECK-109: Updating l10n' && git push && cd -" -# echo "cd check-search && git commit localization -m 'CHECK-109: Updating l10n' && git push && cd -" + +SERVICE="${1:-all}" +ACTION="${2:-all}" + +update_repo() { + local dir=$1 + echo "Updating repo: $dir" + ( + cd "$dir" + git checkout develop + git pull + ) +} + +update_api() { + case "$ACTION" in + push) + echo 'Pushing Check API translations...' + docker compose exec api /tx push + ;; + pull) + echo 'Pulling Check API translations...' + docker compose exec api /tx pull --all -f + # docker compose exec api bundle exec rake transifex:download_tipline + ;; + all|*) + echo 'Pushing + Pulling Check API translations...' + docker compose exec api /tx push + docker compose exec api /tx pull --all -f + ;; + esac + + echo 'Check API:' + (cd check-api && git status) +} + +update_web() { + case "$ACTION" in + push) + echo 'Pushing Check Web translations...' + docker compose exec web npm run transifex:merge-source + docker compose exec web /tx push + ;; + pull) + echo 'Pulling Check Web translations...' + docker compose exec web /tx pull --all -f + docker compose exec web npm run transifex:merge-translated + ;; + all|*) + echo 'Pushing + Pulling Check Web translations...' + docker compose exec web npm run transifex:merge-source + docker compose exec web /tx push + docker compose exec web /tx pull --all -f + docker compose exec web npm run transifex:merge-translated + ;; + esac + echo 'Check Web:' + (cd check-web && git status) +} + +case "$SERVICE" in + check-api) + update_repo check-api + update_api + ;; + check-web) + update_repo check-web + update_web + ;; + all|*) + update_repo check-api + update_repo check-web + + update_api + update_web + # echo 'Updating Check Mark translations...' + # docker compose exec mark npm run transifex:upload + # docker compose exec mark npm run transifex:download + + echo '--- Done! Please review changes and push manually ---' + echo "cd check-api && git commit config/locales -m 'CHECK-109: Updating l10n' && git push" + echo "cd check-web && git commit localization -m 'CHECK-109: Updating l10n' && git push" + ;; +esac From c686324782db210f3a1ca8eecc1c1f9ad6cff363 Mon Sep 17 00:00:00 2001 From: danielevalverde Date: Mon, 1 Sep 2025 17:22:13 -0300 Subject: [PATCH 2/3] add comment --- bin/update-l10n.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/update-l10n.sh b/bin/update-l10n.sh index 3ed6fa2..5203650 100755 --- a/bin/update-l10n.sh +++ b/bin/update-l10n.sh @@ -78,7 +78,8 @@ case "$SERVICE" in # docker compose exec mark npm run transifex:upload # docker compose exec mark npm run transifex:download - echo '--- Done! Please review changes and push manually ---' + # It's safer to run the ones below manually: + echo 'Should be all updated - if it looks good to you, please push to `develop`:' && \ echo "cd check-api && git commit config/locales -m 'CHECK-109: Updating l10n' && git push" echo "cd check-web && git commit localization -m 'CHECK-109: Updating l10n' && git push" ;; From 21bfafa26fe1a89f0f42655a179365e29502c62d Mon Sep 17 00:00:00 2001 From: danielevalverde Date: Mon, 1 Sep 2025 17:26:48 -0300 Subject: [PATCH 3/3] clenup --- bin/update-l10n.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/update-l10n.sh b/bin/update-l10n.sh index 5203650..e5ecb9c 100755 --- a/bin/update-l10n.sh +++ b/bin/update-l10n.sh @@ -79,7 +79,7 @@ case "$SERVICE" in # docker compose exec mark npm run transifex:download # It's safer to run the ones below manually: - echo 'Should be all updated - if it looks good to you, please push to `develop`:' && \ + echo 'Should be all updated - if it looks good to you, please push to `develop`:' echo "cd check-api && git commit config/locales -m 'CHECK-109: Updating l10n' && git push" echo "cd check-web && git commit localization -m 'CHECK-109: Updating l10n' && git push" ;;