path: root/import-translations
diff options
authorintrigeri <>2019-12-28 11:59:05 +0000
committerintrigeri <>2019-12-28 11:59:05 +0000
commit7194227c898f2409d66931b3cd7a36925e5d0faa (patch)
treee799727616eb89b7f92374b124c8e4733bcf5b9e /import-translations
parent225224104768dee7a5cf18d89920f50f28bc0657 (diff)
import-translations: work around the lack of usable branches in Tor's translation.git (refs: #17279)
For all our Transifex resources but tails-misc, Tor's translation.git currently has no usable branch: - The _completed branches that we pull from only have languages which are fully translated and reviewed, i.e. very few translations. - The non-_completed branches have have non-reviewed translations, which we don't want to ship anymore. The real fix will be We've been waiting for it for 3 months now, and it's not sustainable that the RM has to manually workaround the currently problematic situation by hand during every release process. So in the meantime, keep shipping the PO files we've already imported when no suitable up-to-date one is available.
Diffstat (limited to 'import-translations')
1 files changed, 19 insertions, 1 deletions
diff --git a/import-translations b/import-translations
index 79ef56d..df84080 100755
--- a/import-translations
+++ b/import-translations
@@ -70,7 +70,8 @@ eval "$GIT_IN_TOR_TRANSLATION_DIR reset --hard \"origin/$BRANCH\""
# Ensure we only keep PO files that are still present in the Transifex
# branch we import from.
-find "$TAILS_PO_DIR" -name '*.po' -delete
+# XXX: once #16774 is resolved, -delete these files instead.
+find "$TAILS_PO_DIR" -name '*.po' -exec rename 's/$/.orig/' '{}' \;
# For each completely translated language, merge it,
# unless it is translated outside Transifex
@@ -100,6 +101,23 @@ else
+# The _completed branches we still pull from (because the _release
+# branches we need don't exist yet) are mostly empty, so avoid l10n
+# regressions by keeping old PO files instead of deleting them.
+# XXX: remove this hack once #16774 is resolved.
+if echo "$BRANCH" | grep -qs -E '_completed$'; then
+ find "$TAILS_PO_DIR" -name '*.po.orig' -o -name '*.pot.orig' \
+ | while read orig_po_file; do
+ po_file=$(echo "$orig_po_file" | sed 's/\.orig$//')
+ if ! [ -e "$po_file" ]; then
+ echo "${po_file} was removed ⇒ restoring ${orig_po_file}"
+ cp "$orig_po_file" "$po_file"
+ fi
+ rm "$orig_po_file"
+ done
# Update PO files
if [ -n "${AFTER_IMPORT:-}" ]; then