File: choose-tests-locale.sh

package info (click to toggle)
gjs 1.58.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 5,140 kB
  • sloc: cpp: 24,189; sh: 4,931; ansic: 573; makefile: 206; xml: 75
file content (24 lines) | stat: -rwxr-xr-x 778 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

locales=$(locale -a | xargs -n1)

case $locales in
  # Prefer C.UTF-8 although it is only available with newer libc
  *C.UTF-8*) tests_locale=C.UTF-8 ;;
  # C.utf8 has also been observed in the wild
  *C.utf8*) tests_locale=C.utf8 ;;

  # Most systems will probably have this
  *en_US.UTF-8*) tests_locale=en_US.UTF-8 ;;
  *en_US.utf8*) tests_locale=en_US.utf8 ;;

  # If not, fall back to any English UTF-8 locale or any UTF-8 locale at all
  *en_*.UTF-8*) tests_locale=$(echo $locales | grep -m1 en_.\*\\.UTF-8) ;;
  *en_*.utf8*) tests_locale=$(echo $locales | grep -m1 en_.\*\\.utf8) ;;
  *.UTF-8*) tests_locale=$(echo $locales | grep -m1 \\.UTF-8) ;;
  *.utf8*) tests_locale=$(echo $locales | grep -m1 \\.utf8) ;;

  *) tests_locale=C ;;
esac

echo $tests_locale