Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix translation publish and stop excluding removed Crowdin languages (#86090)

Chris Vandoodewaardcb1d8f2a5bcd
diff --git a/.github/workflows/translation-update.yml b/.github/workflows/translation-update.yml
index 9094df00890..01e37268681 100644
--- a/.github/workflows/translation-update.yml
+++ b/.github/workflows/translation-update.yml
@@ -58,16 +58,10 @@ jobs:
command: download
command_args: |
--config ${{ env.METABASE_I18N_CHECKOUT }}/locales/crowdin.yml
- -e=el
-e=et
- -e=es-MX
- -e=gu-IN
-e=hr
-e=lt
- -e=km
-e=pt-PT
- -e=th
- -e=uz
- name: Prepare translation resources
env:
diff --git a/bin/i18n/publish-translations b/bin/i18n/publish-translations
index 9354a5317a3..6c23f021420 100755
--- a/bin/i18n/publish-translations
+++ b/bin/i18n/publish-translations
@@ -3,7 +3,7 @@
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
-checkout="${1:?Usage: publish-translations <checkout>}"
+checkout=$(cd "${1:?Usage: publish-translations <checkout>}" && pwd)
base=$(cat "$checkout/base")
if [ "$(i18n_pin)" != "$base" ]; then
echo "The translation pin changed while this update was being prepared. Start a new update." >&2
diff --git a/bin/i18n/test-translations b/bin/i18n/test-translations
index 9ca2fafd9d9..04c473e4fe5 100755
--- a/bin/i18n/test-translations
+++ b/bin/i18n/test-translations
@@ -78,6 +78,17 @@ test_failed_upload_keeps_pin() {
[ "$(cat "$pin")" = "$first" ] || fail "pin advanced"
}
+test_relative_checkout_publishes() {
+ setup relative
+ printf '#!/usr/bin/env bash\nwhile [ $# -gt 0 ]; do [ "$1" = --body ] && cp "$2" "%s/uploaded.tar.gz"; shift; done\n' "$root" > "$project/stubs/aws"
+ checkout=$(bin/i18n/prepare-translation-update)
+ case "$checkout" in /*) fail "checkout is not relative" ;; esac
+ echo updated > "$checkout/locales/fr.po"
+ bin/i18n/publish-translations "$checkout" > /dev/null 2>&1 || fail "publish failed"
+ [ "$(cat "$pin")" = "latest/$(git rev-parse HEAD)" ] || fail "pin not advanced"
+ [ "$(tar -xzOf "$root/uploaded.tar.gz" fr.po)" = updated ] || fail "wrong upload"
+}
+
test_unchanged_skips_upload() {
setup unchanged
checkout=$(bin/i18n/prepare-translation-update)