Thread (44 messages) flat view 44 messages, 5 authors, 2016-06-15
STALE3733d

[PATCH/RFC 10/17] gettext tests: add detection for is_IS.ISO-8859-1 locale

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:24
Subsystem: the rest · Maintainer: Linus Torvalds

Add a GETTEXT_ISO_LOCALE prerequisite to lib-gettext.sh, it'll be set
if we have an is_IS.ISO-8859-1 locale.

This is needed for an upcoming test that checks if our gettext library
can recode our UTF-8 po/is.po to is_IS.ISO-8859-1 on request.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/lib-gettext.sh |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index f0cdd3d..4570ead 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -18,9 +18,15 @@ then
 		p
 		q
 	}')
-	# Export it as an environmental variable so the t0202/test.pl Perl
-	# test can use it too
-	export is_IS_locale
+	# is_IS.ISO8859-1 on Solaris and FreeBSD, is_IS.iso88591 on Debian
+	is_IS_iso_locale=$(locale -a | sed -n '/^is_IS\.[iI][sS][oO]8859-*1$/{
+		p
+		q
+	}')
+
+	# Export them as an environmental variable so the t0202/test.pl
+	# Perl test can use it too
+	export is_IS_locale is_IS_iso_locale
 
 	if test -n "$is_IS_locale" &&
 		test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
@@ -35,6 +41,20 @@ then
 	else
 		say "# lib-gettext: No is_IS UTF-8 locale available"
 	fi
+
+	if test -n "$is_IS_iso_locale" &&
+		test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
+	then
+		# Some of the tests need the reference Icelandic locale
+		test_set_prereq GETTEXT_ISO_LOCALE
+
+		# Exporting for t0202/test.pl
+		GETTEXT_ISO_LOCALE=1
+		export GETTEXT_ISO_LOCALE
+		say "# lib-gettext: Found '$is_IS_iso_locale' as a is_IS ISO-8859-1 locale"
+	else
+		say "# lib-gettext: No is_IS ISO-8859-1 locale available"
+	fi
 else
 	# Only run some tests when we don't have gettext support
 	test_set_prereq NO_GETTEXT
-- 
1.7.2.2.536.g3f548
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help