Displaying the available locales in english


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Displaying the available locales in english
# 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.
# 2  
Quote:
Originally Posted by eamani_sun
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.
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"
done

If I do it, I'll use "locale language". code above is example.

Last edited by p50p100; 07-27-2008 at 08:40 PM..
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #441
Difficulty: Easy
"Hotel California" by the Eagles is a song about a super A.I. who goes rouge and parties all day and night.
True or False?

9 More Discussions You Might Find Interesting

1. Debian

Locales UTF8 - not working

Hello, I'm facing a strange problem in one of my Debian server, what is happening right now it that I have runned dpkg-reconfigure locales to set en_US UTF-8 so in that way I could use accentuation in my system. # locale -a C en_US.utf8 POSIX pt_BR.utf8 However, when I create a new... (12 Replies)
Discussion started by: pxb368@motorola
12 Replies

2. Shell Programming and Scripting

Setting locales

I'm having a problem with my locale setting. Essentially, when using Xmgrace or Awk, all . are replaced with , leading to wrong arithmetic. Here is an explanation of the problem: awk printing thousands with commas. see LC_ALL=en_US.UTF-8 How can I permanently set the locale... (1 Reply)
Discussion started by: chrisjorg
1 Replies

3. AIX

Locales and conversion tables confusion - Some characters don't get translated

Hello, my program running on AIX receives a message (from MQ) which is in CCSID 870 (LATIN-2 EBCDIC). It needs to convert it to CCSID 912 (ISO-8859-2). For this conversion, it uses the Websphere MQ functionality, but which, according to the manual, uses AIX's system conversion tables. (Btw - it... (1 Reply)
Discussion started by: Adamm
1 Replies

4. Web Development

Detecting browser locales/languages and generating output

We have a Java app that renders Localized text on userís browser session based upon browser language settings. The app reads the browser language settings and prepares the localized text. But recently we faced issues for Mozilla 5.0 version browser. Note our code works fine in IE. Taking an... (1 Reply)
Discussion started by: uunniixx
1 Replies

5. HP-UX

HPUX 10.20 - Warning! One or more of your selected locales are not available.

On our system a user successfully ran the only application on the system this morning. When they tried to login a bit later they could not. The Admin tried to reboot the server and it seemed to reboot ok. When logged in the admin tried to change directories and gets the below message (note they... (1 Reply)
Discussion started by: jmdzied
1 Replies

6. Ubuntu

LANG=C not English?

On Ubuntu 7.04, why would the "C" LANG parameter not be English: $ LANG=C locale LANG=C LANGUAGE=he_IL:he:en_GB:en LC_CTYPE="he_IL.utf8" LC_NUMERIC="he_IL.utf8" LC_TIME="he_IL.utf8" LC_COLLATE="he_IL.utf8" LC_MONETARY="he_IL.utf8" LC_MESSAGES="he_IL.utf8" LC_PAPER="he_IL.utf8"... (4 Replies)
Discussion started by: dotancohen
4 Replies

7. UNIX for Dummies Questions & Answers

formatting date for different locales

Hi, I need to know 1.the usage of LC_TIME with setlocale(). 2.the usage of getdate() utility I read that date formatting for different languages needs 1.user-supplied template file and 2.DATEMSK environment variable set to path of the template fie. Can anyone pls tell... (2 Replies)
Discussion started by: Aeon
2 Replies

8. AIX

Locales in AIX

Currently we have the following locales installed on two of our servers SERVER-1 $ locale -a C POSIX en_US en_US.8859-15 en_US.ISO8859-1 EN_US EN_US.UTF-8 ZH_CN ZH_CN.UTF-8 HI_IN HI_IN.UTF-8 ko_KR ko_KR.IBM-eucKR zh_TW zh_TW.IBM-eucTW SERVER-2 (0 Replies)
Discussion started by: voorkey
0 Replies

9. UNIX for Dummies Questions & Answers

Locales - Solaris 8

Can anyone tell me the difference between the 2 Locales: North American Partial Locales en_US.ISO8859-1 en_US.ISO8859-15 Does it matter which one to use? What are the differences? Thanks. -I have found the below info but I don't know what it means(Also no RFC# for 8859-15): ... (2 Replies)
Discussion started by: finster
2 Replies

Featured Tech Videos