Hi,
I am developing a program that would ask the user to set the locale.
For that, I need to display them to user in plain english.
like
English\(US\)
English \(Uk\)
depending on the user selection I need to set the locale.
Is there a command in redhat linux that would display locales in more friendly mamner rather than like this "en-US.UTF-8"
Thanks,
sunny.
#!/bin/bash
function dump()
{
export na_pre
export na_pos
export na_len
locale -a | while read na
do
na_len=${#na}
#until "_"
na_pre=${na/_*//}
na_pre=${#na_pre}
#before "."
na_pos=${na/?.*//}
na_pos=${#na_pos}
if (( na_len == na_pre || ne_len == na_pos ))
then #no include "_", "."
continue
fi
#get length
((na_pos = na_pos - na_pre))
#(LANGUAGE NAME)=>L1 , (COUNTRY_NAME)=>L2
LANG="$na" GET_LANGNAME="L1=`LANG=$LANG locale language` L2=${LANG:$na_pre:$na_pos} L3=${na/.*/}" && export $GET_LANGNAME
echo $L1\($L2\)\/$L3
done
}
dump | uniq | while read sel
do
echo "$sel"
done
If I do it, I'll use "locale language". code above is example.