ICU4C Proposal: uloc_canonicalize

George Rhoten <[email protected]>
Newsgroups gmane.comp.lib.icu.general
Message-ID <OFCAC3F5AF.D1BDF064-ON86256DCE.0067B080-88256DCE.0068EFCB@us.ibm.com>
I'd like to add the following function

U_CAPI int32_t U_EXPORT2
uloc_canonicalize(const char*    localeID,
         char* name,
         int32_t nameCapacity,
         UErrorCode* err);

It will work similar to uloc_getName(), but it will convert currently 
registered IANA language tags 
<http://www.iana.org/assignments/language-tags>, Microsoft .NET and POSIX 
style locale names to the current ICU format for locale identifiers.

Here are some examples:

de-1901 ->      de__1901        (registered IANA language tag)
uz-UZ-Cyrl      ->      uz_Cyrl_UZ      (.Net name)
C               ->      en_US_POSIX     (The C locale is a common POSIX 
convention)
qz-qz@EURO      ->      qz_QZ@currency=EUR (generic conversion of a POSIX 
Euro locale name)

This function won't be as fast as uloc_getName, but it will allow you to 
get a proper ICU locale ID based on a locale identifier coming from other 
sources of localized data.

deadline for comments: November 5th, 2003

George Rhoten
IBM Globalization Center of Competency/ICU  San José, CA, USA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.