summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsegfault <segfault@riseup.net>2019-10-02 22:17:10 +0200
committersegfault <segfault@riseup.net>2019-10-04 15:42:10 +0200
commit257bd1f0a5e64de84f921e2ab2e2f822018c3465 (patch)
tree1b93523fdb39b7fe10e9a7280a9ae42a047caf1e
parent9ce0d48ea8654e1ff362a9400931fb2bc4efe152 (diff)
Generate the list of supported languages during build (refs: #16095)
-rw-r--r--.gitignore1
-rwxr-xr-xauto/build3
-rw-r--r--config/chroot_local-includes/usr/share/tails/greeter/locales33
-rwxr-xr-xgenerate-languages-list19
4 files changed, 23 insertions, 33 deletions
diff --git a/.gitignore b/.gitignore
index 903fa32..78d237c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,7 @@
/config/chroot_local-includes/usr/share/doc/amnesia/Changelog
/config/chroot_local-includes/usr/share/doc/tails/website
/config/chroot_local-includes/usr/share/tails/build/variables
+/config/chroot_local-includes/usr/share/tails/greeter/supported_languages
/.lock
/.stage
/source
diff --git a/auto/build b/auto/build
index bfed3a6..d6cd96e 100755
--- a/auto/build
+++ b/auto/build
@@ -117,6 +117,9 @@ export MKSQUASHFS_OPTIONS
# refresh translations of our programs
./refresh-translations || fatal "refresh-translations failed ($?)."
+# generate list of supported languages
+./generate-languages-list || fatal "generate-languages-list failed ($?)."
+
BUILD_ISO_FILENAME="${BUILD_BASENAME}.iso"
BUILD_MANIFEST="${BUILD_BASENAME}.build-manifest"
BUILD_APT_SOURCES="${BUILD_BASENAME}.apt-sources"
diff --git a/config/chroot_local-includes/usr/share/tails/greeter/locales b/config/chroot_local-includes/usr/share/tails/greeter/locales
deleted file mode 100644
index 0b161b7..0000000
--- a/config/chroot_local-includes/usr/share/tails/greeter/locales
+++ /dev/null
@@ -1,33 +0,0 @@
-ar_EG
-bn_BD
-ca_ES
-cs_CZ
-de_DE
-el_GR
-en_US
-es_ES
-es_AR
-fa_IR
-fi_FI
-fr_FR
-fr_CA
-ga_IE
-he_IL
-hi_IN
-hr_HR
-hu_HU
-id_ID
-it_IT
-km_KH
-ko_KR
-lt_LT
-pl_PL
-pt_BR
-pt_PT
-ro_RO
-ru_RU
-sk_SK
-sl_SI
-sv_SE
-tr_TR
-zh_CN \ No newline at end of file
diff --git a/generate-languages-list b/generate-languages-list
new file mode 100755
index 0000000..d8daded
--- /dev/null
+++ b/generate-languages-list
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+set -e
+set -u
+
+echo "Generating list of supported languages"
+
+OUTFILE="config/chroot_local-includes/usr/share/tails/greeter/supported_languages"
+
+# Add our tier-1 supported languages
+LANG_CODES="ar de en es fa fr hi it pt ru tr zh"
+
+# Add the languages which have translations in Tails
+TRANSLATED="$(find po -name "*.po" -exec basename {} \; | \
+ sed -e "s/\.po//" -e "s/\(.*\)_.*/\1/g")"
+LANG_CODES="${LANG_CODES} ${TRANSLATED}"
+
+# Write the list to the output file
+echo "${LANG_CODES}" | tr " " "\n" | sort | uniq | tr "\n" " " > "${OUTFILE}"