summaryrefslogtreecommitdiffstats
path: root/import-translations
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-09-30 13:40:48 +0000
committersegfault <segfault@riseup.net>2019-10-03 11:23:54 +0200
commit9838cfd8955c9d01f4dbf65cdd5324a6c8e56750 (patch)
treee7d0b7087925548af729a86df47d4cb728678d11 /import-translations
parentb19bd7b6b695b2f5ab242f324742023e62309b96 (diff)
import-translations: don't import PO files with no translated string (refs: #17106)
On #16774 we decided we want to import from Transifex: - only reviewed translations → this was done for the tails-misc resource on the tails-misc_release branch - only PO files with at least one translated+reviewed string → emmapeel tells me she can't easily do this on Tor's side, so we need to filter out these PO files in import-translations This matters because the code on #16095 will make decisions based on which PO files are present in tails.git:po/, and it assumes that the aforementioned criteria is implemented there.
Diffstat (limited to 'import-translations')
-rwxr-xr-ximport-translations12
1 files changed, 12 insertions, 0 deletions
diff --git a/import-translations b/import-translations
index 7c95ac2..79ef56d 100755
--- a/import-translations
+++ b/import-translations
@@ -68,6 +68,10 @@ fi
eval "$GIT_IN_TOR_TRANSLATION_DIR checkout \"$BRANCH\""
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
+
# For each completely translated language, merge it,
# unless it is translated outside Transifex
if [ "$LANG_DOT_PO_LAYOUT" = yes ] ; then
@@ -75,6 +79,10 @@ if [ "$LANG_DOT_PO_LAYOUT" = yes ] ; then
lang=$(basename "$po_file" | tr - _ | sed 's/\.po$//')
! lang_is_excluded "$lang" || continue
+ if [ "$(cat "$po_file" | count_translated_strings)" -lt 1 ]; then
+ echo "Skipping $lang, that has no translated strings."
+ continue
+ fi
echo "Importing translation for $lang..."
cp "$po_file" "$TAILS_PO_DIR"
done
@@ -83,6 +91,10 @@ else
lang=$(basename $(dirname "$po_file" | tr - _ | sed 's/\.pot$//'))
! lang_is_excluded "$lang" || continue
+ if [ "$(cat "$po_file" | count_translated_strings)" -lt 1 ]; then
+ echo "Skipping $lang, that has no translated strings."
+ continue
+ fi
echo "Importing translation for $lang..."
cp "$po_file" "$TAILS_PO_DIR/${lang}.po"
done