getFallback() on a ULocale does not pass through ULocale.ROOT

Description

I am using ICU-J 4.0 and have following issues-

1) According to the user guide, getfallback() function internally
keeps stripping the given locale name till it finds a valid locale.
For example, if a resource bundle for zh_Hans_CN is opened, a missing resource will be looked for in zh_Hans, zh and finally root.
But when getfallback() function is used, it finally reaches null
instead of root. ULocale#getFallback() should return ULocale.ROOT before returning null. But it does not return ULocale.ROOT, instead it returns null.


2) I am trying to figure out the purpose of ULocale.ROOT, as per my
understanding, it is the root locale we eventually fall back to, after all locale information gets progressively stripped away. Is it intended to be used in a way other than what I am doing? If we can't use ULocale.ROOT to detect that we have reached the root locale, how do we test for this?

The behavior of getFallback() is the same in ICUJ 4.0 as that of ICUJ 3.2; it used to return ULocale object with empty string for –

and still returns a ULocale object with empty string in case of ICU-J 4.0. However, the behavior has changed when you create ULocale.ROOT. Earlier it used to return ULocale object with empty string(and hence it used to match the assert conditions) but now it returns ULocale object with string“root”.

Activity

Show:
TracBot
July 1, 2018, 12:00 AM
Trac Comment 7 by —2009-11-18T16:44:23.000Z

Conclusions in a conference call held on 2009-11-17 (http://site.icu-project.org/design/locale/root):\\

  • Change ULocale.ROOT's string representation from "root" to "" (empty string)

  • Same behavior for static String getFallback(String) (except String version won't return null for empty locale ID)

TracBot
July 1, 2018, 12:00 AM
Trac Comment 10 by —2016-10-05T23:15:05.064Z

Milestone 4.3.4 deleted

Fixed

Assignee

Yoshito Umaoka

Reporter

TracBot

Components

Labels

Reviewer

None

Priority

major

Time Needed

Days

Fix versions