12.07.2015 Views

free openSS

free openSS

free openSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

42 ❘ FREE/OPEN SOURCE SOFTWARE: LOCALIZATIONThe LC_COLLATE specification is the most complicated of all locale categories. There is a separate standardfor collating Unicode strings, called ISO/IEC 14651 International String Ordering. 29 The glibc default localedefinition is based on this standard. Locale developers may consider investigating the Common TailorableTemplate (CTT) defined there before beginning their own locale definition.In the CTT, collation is done through multiple passes. Character weights are defined in multiple levels(four levels for ISO/IEC 14651). Some characters can be ignored (by using “IGNORE” as weight) at firstpasses and be brought into consideration in later passes for finer adjustment. Please see ISO/IEC 14651document for more details.LC_TIMELC_TIME allows localization of date/time strings formatted by the strftime() function. Days of week andmonths can be translated into the locale language, appropriate dateLC_NUMERIC & LC_MONETARYEach culture uses different conventions for writing numbers, namely, the decimal point, the thousandseparator and grouping. This is covered by LC_NUMERIC.LC_MONETARY defines currency symbols used in the locale as per ISO 4217, as well as the format inwhich monetary amounts are written. A single function localeconv() in is defined for retrievinginformation from both locale categories. Glibc provides an extra function strfmon() in forformatting monetary amounts as per LC_MONETARY, but this is not standard C function.LC_MESSAGESLC_MESSAGES is mostly used for message translation purposes. The only use in POSIX locale is thedescription of a yes/no answer for the locale.ISO/IEC 14652The ISO/IEC 14652 Specification method for cultural conventions 30 is basically an extended POSIX localespecification. In addition to the details in each of the six categories, it introduces six more:CategoryLC_PAPERLC_NAMELC_ADDRESSLC_TELEPHONELC_MEASUREMENTLC_VERSIONDescriptionpaper sizepersonal name formataddress formattelephone numbermeasurement unitslocale versionAll of the above categories have already been supported by glibc. C applications can retrieve all localeinformation using the nl_langinfo() function.Building LocalesTo build a locale, a locale definition file describing data for ISO/IEC 14652 locale categories must beprepared. (See the standard document for the file format.) In addition, when defining a new characterset, a charmap file must be created for it; this gives every character a symbolic name and describesencoded byte strings.In general, glibc uses UCS symbolic names () in locale definition, for convenience in generatinglocale data for any charmap. The actual locale data to be used by C programs is in binary form. The localedefinition must be compiled with the localedef command, which accepts arguments like this:localedef [-f ] [-i ] For example, to build th_TH locale from locale definition file th_TH using TIS-620 charmap:29ISO/IEC, ISO/IEC JTC1/SC22/WG20 – Internationalization; available from anubis.dkuug.dk/jtc1/sc22/wg20.30Ibid.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!