File: languagemap

package info (click to toggle)
localechooser 2.84
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,612 kB
  • sloc: sh: 1,096; perl: 187; makefile: 71; awk: 42
file content (46 lines) | stat: -rw-r--r-- 868 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# Usage:
#   LANGNAME=<value>
#   . languagemap
#
# The calling script should provide the log() function

for list in /etc/languagelist /usr/share/localechooser/languagelist ./languagelist; do
	if [ -f "$list" ]; then
		languages="$list"
		break
	fi
done

log "Language = '$LANGUAGE'"

line=$(grep "^$LANGUAGE;" $languages || true)
log "line=$line"

DEFAULT_COUNTRY=""
DEFAULT_LOCALE=""
LANGUAGELIST=""
CONSOLE=""

if [ "$line" ] ; then
	OLD_IFS="$IFS"
	IFS=';'
	set $line
	IFS="$OLD_IFS"

	if [ "$3" ]; then DEFAULT_COUNTRY="$3"; fi
	if [ "$4" ]; then DEFAULT_LOCALE="$4"; fi
	if [ "$5" ]; then LANGUAGELIST="$5"; fi
	if [ "$6" ]; then CONSOLE="$6"; fi

	if [ -z "$LANGUAGELIST" ] ; then
		LANGUAGELIST="$LANGUAGE"
	fi
else
	log "error: Unable to locate info for language '$LANGUAGE'"
	LANGUAGE=C
	DEFAULT_COUNTRY=US
	DEFAULT_LOCALE=C
	LANGUAGELIST=en
fi