LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-31-2005, 03:58 AM   #1
infantpapa
LQ Newbie
 
Registered: Dec 2004
Posts: 27

Rep: Reputation: 15
how to create locales for linux


hi all,

i want to create a locale in the linux for my local language.so please if any one could give me the architecture to create a locale and specifications to create a locale . if any one could provide with the samples or any link could be appreciated .

thanks
san
 
Old 11-01-2005, 02:59 PM   #2
dd12
LQ Newbie
 
Registered: Sep 2005
Posts: 28

Rep: Reputation: 15
This is a draft document explaining how to write locale files for GNU libc. It will not go into details, but reference specifications. It will on the other hand mention some of the pitfalls, and try to document the current practice.

How to choose the locale file name
Locale names consist of three parts. The language code, the country/region code, and the optional modifier. The format is language_REGION@modifier. The language code is a code from ISO 639. The two-letter code is prefered, but a three letter code is accepted if no two-letter code is available. The country/region code is a code from ISO 3166. If the language or region in question is missing in the ISO standard, one need to get the ISO standard updated before the locale will be included in glibc. If one can't convince the ISO 639 maintainers that your language exists (and thus need a language code), the glibc maintainers will refuse to add the locale. In addition, the glibc maintainers seem to refuse "artificial languages" like Esperanto and Lojban, even if they got a ISO 639 code.

Little is known about the requirements for the naming of modifiers. The following modifiers are currently used: abegede, cyrillic, euro and saaho. This might indicate that lower case letters are prefered in modifier names.

It is recommended to follow RFC 3066 when selecting locale names.

ISO 3166
ISO 639
RFC 3066 - Tags for the Identification of Languages
Category order
To make it easier to compare locales with each other, I recommend using the same order for the categories in all locales. Any order will do, so I picked the order used in most locales, and decided to recommend this order:

LC_IDENTIFICATION
LC_CTYPE
LC_COLLATE
LC_MONETARY
LC_NUMERIC
LC_TIME
LC_MESSAGES
LC_PAPER
LC_NAME
LC_ADDRESS
LC_TELEPHONE
LC_MEASUREMENT
Reuse when possible
One should avoid cut-n-paste when possible, and instead use the copy statement to include sections from locales with identical content.

LD_IDENTIFICATION
The category entries are references to the standard used when writing the given section. The standard refs should have quotes around them, and should not use the <U#> notation. They should normally look something like this:

category "i18n:1997";LC_IDENTIFICATION

LC_MESSAGES
Then yesexpr and noexpr entries should have the form ^[yY<extra>] and ^[nN<extra>], without 0 and 1 and without trailing ".*". The reason is to make sure the expressions have the same form as the expressions used in the C/POSIX locale (^[yY] and ^[nN]).

Standard documents and specifications
Testing the new locale file
To test a new locale on a test machine, do the following:

Copy the new locale to /usr/share/i18n/locales/filename
Run localedef -i inputfile -c -f charset locale to generate a binary locale file in /usr/lib/locale/locale/
Test it using LANG=locale, for example by running date
Example, generating a new de_DE@euro locale using the ISO-8859-15 charset and save it as 'de_DE':

cp de_DE@euro /usr/share/i18n/locales/de_DE@euro
localedef -i de_DE@euro -c -f ISO-8859-15 de_DE
LANG=de_DE date

I've made a small tool check-locale capable of detecting a few common mistakes with locales
Petter Reinholdtsen
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
locales mrbabis Linux - Software 5 10-28-2005 04:24 PM
once again locales mib_ths Ubuntu 1 07-26-2005 04:23 PM
Linux, Create Dirs=no, Create files=yes. Possible? tisource Linux - General 4 01-12-2004 10:05 PM
dselect doesn't see util-linux-locales package franco Debian 1 10-24-2003 08:53 AM
locales-en jimjamz Linux - General 2 06-07-2001 08:59 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration