Collator::getLocale(actual/valid) with collation keyword?

Description

As far as I can tell, Collator::getLocale(actual/valid) never includes any collation keyword because it is populated from ures_getLocaleByType() from the resource bundle that contains the data. (Need to write a test case, but I don't see any code that sets the keyword.)

That is, `Collator::createInstance(de@collation=phonebook).getLocale(actual or valid)` returns "de" even though you get different collators for "de" vs. "de@collation=phonebook".

It seems like for getLocale() to make sense we would want the collation type included unless it is the default type. That is, I would probably continue to suppress the collation keyword for de@collation=standard and zh@collation=pinyin etc.

Note that getLocale() is still marked as "@deprecated ICU 2.8 This API is under consideration for revision in ICU 3.0" because we have never settled on how to make it work, and make it useful.

Note also: When we start supporting other keywords like "alternate=shifted", I would continue to omit those from getLocale() because they do not affect the tailoring that is loaded, they only override settings (which can be reverted after loading).

Activity

Show:

UnicodeBot 
June 30, 2018 at 11:48 PM

Trac Comment 3 by —2014-01-03T22:31:02.826Z

FYI: tested in CollationAPITest::TestGetLocale()

UnicodeBot 
June 30, 2018 at 11:48 PM

Trac Comment 2 by —2013-10-11T20:07:02.506Z

need to write test code

UnicodeBot 
June 30, 2018 at 11:48 PM

Trac Comment 1 by —2013-10-09T18:13:23.336Z

Include the collation keyword, relevant for the data loaded, in getLocale(). Plan on a separate API that returns a Locale with all attribute keywords.

Fixed

Details

Assignee

Reporter

Components

Priority

Time Needed

Hours

Fix versions

Created June 28, 2018 at 5:21 PM
Updated October 3, 2018 at 10:54 PM
Resolved July 1, 2018 at 8:44 PM