|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Displaying the available locales in english
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. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Quote:
Code:
#!/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"
doneIf I do it, I'll use "locale language". code above is example. Last edited by p50p100; 07-27-2008 at 06:40 PM.. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Detecting browser locales/languages and generating output | uunniixx | Web Programming | 1 | 02-18-2011 08:30 PM |
| HPUX 10.20 - Warning! One or more of your selected locales are not available. | jmdzied | HP-UX | 1 | 10-05-2010 05:13 AM |
| formatting date for different locales | Aeon | UNIX for Dummies Questions & Answers | 2 | 08-23-2007 12:39 AM |
| Locales in AIX | voorkey | AIX | 0 | 06-08-2006 01:08 PM |
| Locales - Solaris 8 | finster | UNIX for Dummies Questions & Answers | 2 | 07-26-2003 12:24 PM |
|
|