summaryrefslogtreecommitdiff
path: root/scripts/live-functions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2008-04-16 09:02:46 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 17:47:59 +0100
commit9863b7ac3829367dfa144a0bdaf812b39362d264 (patch)
tree88e311f5ebd1195c83e703fddbde876a17bf08b8 /scripts/live-functions
parent47527b7666b1a12122a0b17098064e7af745d097 (diff)
downloadlive-boot-9863b7ac3829367dfa144a0bdaf812b39362d264.tar.gz
live-boot-9863b7ac3829367dfa144a0bdaf812b39362d264.zip
Merging casper 1.130.
Diffstat (limited to 'scripts/live-functions')
-rw-r--r--scripts/live-functions29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/live-functions b/scripts/live-functions
index 964fdf0..b6d04fb 100644
--- a/scripts/live-functions
+++ b/scripts/live-functions
@@ -29,3 +29,32 @@ really_export ()
eval export "${STRING}"="${VALUE}"
}
+
+lang2locale() {
+ langpart="${1%%_*}"
+ if [ "$1" != "C" ]; then
+ # Match the language code with 3rd field in languagelist
+ line=$(grep -v "^#" /root/usr/share/localechooser/languagelist | cut -f3,4,5 -d\; | grep -v ';C$' | grep "^$langpart;")
+ if [ -n "$line" ]; then
+ if [ "$(echo "$line" | grep -c '')" -gt 1 ]; then
+ # More than one match; try matching the
+ # country as well.
+ countrypart="${1#*_}"
+ if [ "$countrypart" = "$1" ]; then
+ countryline="$(echo "$line" | head -n1)"
+ echo "${countryline##*;}"
+ return
+ fi
+ countrypart="${countrypart%%[@.]*}"
+ countryline="$(echo "$line" | grep ";$countrypart;" | head -n1 || true)"
+ if [ "$countryline" ]; then
+ echo "${countryline##*;}"
+ return
+ fi
+ fi
+ echo "${line##*;}"
+ fi
+ else
+ echo "C"
+ fi
+}