Code

i18n: add infrastructure for translating Git with gettext
[git.git] / t / lib-gettext.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
4 #
6 . ./test-lib.sh
8 GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
9 GIT_PO_PATH="$GIT_BUILD_DIR/po"
10 export GIT_TEXTDOMAINDIR GIT_PO_PATH
12 . "$GIT_BUILD_DIR"/git-sh-i18n
14 if test_have_prereq GETTEXT && ! test_have_prereq GETTEXT_POISON
15 then
16         # is_IS.UTF-8 on Solaris and FreeBSD, is_IS.utf8 on Debian
17         is_IS_locale=$(locale -a | sed -n '/^is_IS\.[uU][tT][fF]-*8$/{
18                 p
19                 q
20         }')
21         # is_IS.ISO8859-1 on Solaris and FreeBSD, is_IS.iso88591 on Debian
22         is_IS_iso_locale=$(locale -a | sed -n '/^is_IS\.[iI][sS][oO]8859-*1$/{
23                 p
24                 q
25         }')
27         # Export them as an environment variable so the t0202/test.pl Perl
28         # test can use it too
29         export is_IS_locale is_IS_iso_locale
31         if test -n "$is_IS_locale" &&
32                 test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
33         then
34                 # Some of the tests need the reference Icelandic locale
35                 test_set_prereq GETTEXT_LOCALE
37                 # Exporting for t0202/test.pl
38                 GETTEXT_LOCALE=1
39                 export GETTEXT_LOCALE
40                 say "# lib-gettext: Found '$is_IS_locale' as an is_IS UTF-8 locale"
41         else
42                 say "# lib-gettext: No is_IS UTF-8 locale available"
43         fi
45         if test -n "$is_IS_iso_locale" &&
46                 test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
47         then
48                 # Some of the tests need the reference Icelandic locale
49                 test_set_prereq GETTEXT_ISO_LOCALE
51                 say "# lib-gettext: Found '$is_IS_iso_locale' as an is_IS ISO-8859-1 locale"
52         else
53                 say "# lib-gettext: No is_IS ISO-8859-1 locale available"
54         fi
55 fi