X-Git-Url: https://pere.pagekite.me/gitweb/homepage.git/blobdiff_plain/95edbddad1ffb1b3ea0af9ca5e48069351462d1d..ae5db6d19f3d85fdd5e7bd4c12be28fa3f15fc43:/linux/glibc/howto.html diff --git a/linux/glibc/howto.html b/linux/glibc/howto.html index 008ebbc53e..7b68909fb8 100644 --- a/linux/glibc/howto.html +++ b/linux/glibc/howto.html @@ -12,7 +12,6 @@

How to write a GNU libc locale

-
by Petter Reinholdtsen
@@ -28,7 +27,40 @@

How to choose the locale file name

- - how to choose the 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.

+ +

Category order

@@ -54,25 +86,71 @@

Reuse when possible

- - "copy" from existing locales if the content should be identical +

One should avoid cut-n-paste when possible, and instead use + the copy statement to include sections from locales + with identical content.

-

LD_INDENTIFICATION

+

LD_IDENTIFICATION

- - standard refs in the LD_INDENTIFICATION +

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

- - yes/no expr should have the form ^[yYnN], without 0 and 1 +

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:

+ + + +

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
-Last modified: Sat May 15 11:56:09 CEST 2004 +Last modified: Mon Dec 20 20:17:59 CET 2004