X-Git-Url: http://git.draconx.ca/gitweb/dxcommon.git/blobdiff_plain/02e6afe4c4956fd667dfefc04e8f129b5b84f709..15c81590df7ef0ff8ec387b259fee8dac8ceda0e:/snippet/test-nls.at diff --git a/snippet/test-nls.at b/snippet/test-nls.at index 103cb5b..c713abb 100644 --- a/snippet/test-nls.at +++ b/snippet/test-nls.at @@ -39,7 +39,8 @@ test_find_locale_charmap '[[Uu][Tt][Ff]-*8]']) # standard output. # # By default, the user's own LC_CTYPE is preferred. Otherwise, the first -# match in the output of "locale -a" is chosen. +# match in the output of "locale -a" is chosen, unless that starts with +# "C" in which case we prefer the next one. m4_defun_once([_TEST_NLS_SETUP], [m4_divert_push([HEADER-COPYRIGHT]) # save user locale setting before m4sh clobbers it @@ -59,19 +60,31 @@ test_find_locale_charmap () { $[1] = ""; sub(/^ "/, ""); sub(/"$/, ""); print }'` - LC_ALL=$save_LC_ALL + LC_ALL=$save_LC_ALL found_locale= if test_check_locale_charmap "$init_ctype" "$re"; then - AS_ECHO(["$init_ctype"]) - return; + found_locale=$init_ctype fi - set x `locale -a | grep "$re"`; shift - for arg; do - if test_check_locale_charmap "$arg" "$re"; then - AS_ECHO(["$arg"]) - return; - fi - done + case $found_locale in + C*|"") + set x `locale -a | grep "$re"`; shift + for arg; do + if test_check_locale_charmap "$arg" "$re"; then + found_locale=$arg; + case $found_locale in + C*) :;; + *) break ;; + esac + fi + done + ;; + esac + + test ${found_locale+y} && { + AS_ECHO(["found matching locale $found_locale"]) >&AS_MESSAGE_LOG_FD + LC_ALL=$found_locale locale >&AS_MESSAGE_LOG_FD 2>&1 + AS_ECHO(["$found_locale"]) + } } m4_divert_pop([PREPARE_TESTS]) ])