t8*: adjust the references to the default branch name "main"
[git] / t / lib-gettext.sh
1 # Initialization and Icelandic locale for basic git i18n tests,
2 # which source this scriptlet instead of ./test-lib.sh.
3 #
4 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
5 #
6
7 . ./test-lib.sh
8
9 GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
10 GIT_PO_PATH="$GIT_BUILD_DIR/po"
11 export GIT_TEXTDOMAINDIR GIT_PO_PATH
12
13 if test -n "$GIT_TEST_INSTALLED"
14 then
15         . "$(git --exec-path)"/git-sh-i18n
16 else
17         . "$GIT_BUILD_DIR"/git-sh-i18n
18 fi
19
20 if test_have_prereq GETTEXT && test_have_prereq C_LOCALE_OUTPUT
21 then
22         # is_IS.UTF-8 on Solaris and FreeBSD, is_IS.utf8 on Debian
23         is_IS_locale=$(locale -a 2>/dev/null |
24                 sed -n '/^is_IS\.[uU][tT][fF]-*8$/{
25                 p
26                 q
27         }')
28         # is_IS.ISO8859-1 on Solaris and FreeBSD, is_IS.iso88591 on Debian
29         is_IS_iso_locale=$(locale -a 2>/dev/null |
30                 sed -n '/^is_IS\.[iI][sS][oO]8859-*1$/{
31                 p
32                 q
33         }')
34
35         # Export them as an environment variable so the t0202/test.pl Perl
36         # test can use it too
37         export is_IS_locale is_IS_iso_locale
38
39         if test -n "$is_IS_locale" &&
40                 test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
41         then
42                 # Some of the tests need the reference Icelandic locale
43                 test_set_prereq GETTEXT_LOCALE
44
45                 # Exporting for t0202/test.pl
46                 GETTEXT_LOCALE=1
47                 export GETTEXT_LOCALE
48                 say "# lib-gettext: Found '$is_IS_locale' as an is_IS UTF-8 locale"
49         else
50                 say "# lib-gettext: No is_IS UTF-8 locale available"
51         fi
52
53         if test -n "$is_IS_iso_locale" &&
54                 test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
55         then
56                 # Some of the tests need the reference Icelandic locale
57                 test_set_prereq GETTEXT_ISO_LOCALE
58
59                 say "# lib-gettext: Found '$is_IS_iso_locale' as an is_IS ISO-8859-1 locale"
60         else
61                 say "# lib-gettext: No is_IS ISO-8859-1 locale available"
62         fi
63 fi