History log of /libcore/luni/src/main/java/libcore/icu/ICU.java
Revision Date Author Comments
9c853c5b9ebbb0ef60a013ae10ee411d70dfa832 18-Feb-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementations of java.text.*

- LocaleInternalsTest has been disabled since it depends on
internal implementation details.
- Collator: Use libcore's RuleBasedCollatorICU to fetch collator
rules instead of sun.misc.resources.LocaleData & friends.
- DateFormat: Add support for set24HourTimePref (not wired up
yet).
- DateFormatSymbols : Use libcore's LocaleData & TimeZoneNames
classes internally.
- NumberFormat: Use libcore's LocaleData.
- Drop support for SCIENTIFICSTYLE (we should re-enable this at
some point ?).
- SimpleDateFormat : Don't reject the format specifiers for
standalone weekday and friends. We'll need to switch over to
using ICU4J formatters at some point.
- Calendar : Use GregorianCalendar only.
- TimeZone : Use TimeZoneNames to access time zone names.

Change-Id: I4a2866904d4f2f39f0793154d9aad7f109da3b5a
cf14cc4ee0de8c3e4f9a1dab7a5a91d09264dee9 27-Mar-2015 Neil Fuller <nfuller@google.com> Add a test to confirm that TZ data is in sync

Android has two sources of timezone data: one used by
bionic / libcore code, and one used by ICU.

When ICU4J is added more tests can be added to confirm
that ICU4C and ICU4J agree on time zone and other sources
of data like CLDR and the ICU version itself.

Bug: 19941636
Change-Id: I614392a876e19a55e362489f142eec71beaf5547
2e11dca269a4bf6bb2c36096b0b97d41375b9810 30-Jul-2014 Narayan Kamath <narayan@google.com> Add ICU.addLikelySubtags(Locale).

We don't need a replacement for ICU.getScript(String),
Locale.getScript() can be used instead. The old definition
of the function has been left public for the support library
to use (though we could remove it if we modify the support lib).

Note that addLikelySubtag returns a String that's language tag
like, but uses underscores instead of hyphens to separate
subtags.

bug: 15876704

(cherry picked from commit 9c4462b3d88a36c92d23d4274195e4a7f7a372e5)

Change-Id: I3d2896a94c983e636523664315d09c93839dd9ae
9c4462b3d88a36c92d23d4274195e4a7f7a372e5 30-Jul-2014 Narayan Kamath <narayan@google.com> Add ICU.addLikelySubtags(Locale).

We don't need a replacement for ICU.getScript(String),
Locale.getScript() can be used instead. The old definition
of the function has been left public for the support library
to use (though we could remove it if we modify the support lib).

Note that addLikelySubtag returns a String that's language tag
like, but uses underscores instead of hyphens to separate
subtags.

bug: 15876704
Change-Id: I6c7d289c4b725a83900e38dd5bbed026afd9ac4e
df624c1cc36dc17e4051d1100a3400aeb4252511 25-Jun-2014 Narayan Kamath <narayan@google.com> Fix handling of invalid locales in Date/DecimalFormatSymbols.

For locales whose language code is "und" we use Locale.ROOT
instead. This also fixes two other corner cases :

- We were using the wrong locale to fetch timezone strings
when the input locale was null. we now use the same locale
throughout by making sure we don't perform any subsititutions
in LocaleData.get.

- Adds a clearer comment about the broken serialization
behaviour.

bug: 15849709

(cherry picked from commit 043a1424a4e3bbb5abc9d9e11c9c088b20f4ca7d)

Change-Id: I716fb421fb8643dedebb3a7797a76ed1dd86c548
ac89b307fd132d44ac55b9109833730cbc2e86fc 21-Jul-2014 Narayan Kamath <narayan@google.com> Implement Locale.forLanguageTag in java.

This prevents us from having to parse ICU locale IDs
or construct them in java. Note that the changes to
LocaleTest bring us in line with the spec (some of the
previous tests demonstrated wonky ICU4C behaviour we
didn't want).

This change includes a minor fix to unicode extension
parsing, we now accept keywords with empty values which
the spec allows.

bug: 15661724
bug: 15849709

(cherry picked from commit bf098bb6345b0917d645d809f4d703e6a0c904f4)

Change-Id: I9b5417dd32bd758655085a484db071959edb774e
5c0472fd7c53464e526bb833707551d85dbafec1 25-Jun-2014 Narayan Kamath <narayan@google.com> Fix handling of invalid locales in Date/DecimalFormatSymbols.

For locales whose language code is "und" we use Locale.ROOT
instead. This also fixes two other corner cases :

- We were using the wrong locale to fetch timezone strings
when the input locale was null. we now use the same locale
throughout by making sure we don't perform any subsititutions
in LocaleData.get.

- Adds a clearer comment about the broken serialization
behaviour.

bug: 15849709

Change-Id: I95e7eb0ccb7458711038ce9b1c76b3279acda9d6
bf098bb6345b0917d645d809f4d703e6a0c904f4 21-Jul-2014 Narayan Kamath <narayan@google.com> Implement Locale.forLanguageTag in java.

This prevents us from having to parse ICU locale IDs
or construct them in java. Note that the changes to
LocaleTest bring us in line with the spec (some of the
previous tests demonstrated wonky ICU4C behaviour we
didn't want).

This change includes a minor fix to unicode extension
parsing, we now accept keywords with empty values which
the spec allows.

bug: 15661724
bug: 15849709

Change-Id: If9417ab4cb545fdb8b9a0a47a7eade6ebbe33ba8
1d3d40749170e945b778e74786543520fbe9d14c 17-Jun-2014 Neil Fuller <nfuller@google.com> Fix CurrencyTest.test_getSymbol for unknown variants

The behavior of CurrencyTest.getSymbol has changed since
K for unrecoginzed locales.

Commit de0eb683370d789e7bb25673b350b8dbf2ba5d69 now means
the ICU default locale is set when the Java default locale
is changed. Previously it would have been left unset and
would have fallen back to using the system settings (most
likely US or UK English during tests).

The test is setting the Java default locale to "kr-KR"
(a locale unrecognized by ICU) and requesting the currency
symbol for USD for locale "kr-KR" (still unrecognized by
ICU).

Before the commit: Because the kr-KR argument is unrecognized
ICU tries the ICU default (which was unset and so picked
system setting of en). It returned "$".

After the commit: As above, but now the ICU default is set to
kr-KR. Since there is no entry for USD in the default it falls
back to "root", and returns the value found there: "US$".

Behavior when the default locale is unrecognized is edge-case
and arguably it is no more / less correct before or after
this commit. The test has been updated to reflect
the new value + some tidy up of the test generally.

This change also contains a more focused test that demonstrates
the behavior in ICU and adds documentation to make ICU
slightly clearer.

Arguably neither the new ICUTest nor the existing
CurrencyTest code should exist because they assert edge-case behavior
that Android may wish to change in future.

Bug: 14821275
Change-Id: I8beb6004b0c37d2fe59855d13d2c8e2e6fe1c530
ca6c2dfd21fef61f179223fb710db791802068d5 18-Jun-2014 Narayan Kamath <narayan@google.com> Fix getISO3Country and getISO3Language.

For backward compatibility, locales constructed with 3 letter
countries and languages must return those languages and countries
from these methods. With our strict language tag interpretation, these
were being omitted or transformed to und.

We fix this by passing only the language code (or the country code
with a fixed language) down to ICU, which will then deal with it
correctly.

bug: 15638049

Change-Id: I517a82496a2a4c36b1ae9234f7d2d4eb89b34ffe
12ca8820818b604c6fc30f025857ec443c83d4a3 11-Jun-2014 Narayan Kamath <narayan@google.com> Implement Locale.toLanguageTag without ICU support.

This is the first part of an effort to avoid having
to construct and parse ICU locale IDs and to instead
use language tags as inputs to all ICU APIs.

Only one minor unit test adjustment was required, and
that change brings the test closer in line with the
spec.

Change-Id: I8abc0e3b868dd73e4fb9e36b6db19853eb99e6ac
a94266074c7b82720fd2cecfb37ab8da85f1b296 30-May-2014 Elliott Hughes <enh@google.com> Pass BCP-47 tags and not Locale.toString results to ICU.

ICU can't handle the new toString forms for scripts etc.
and it's also guaranteed to deal with BCP-47 tags correctly.

Most of the changes in this patch are required to keep
backwards compatibility for getDisplayCountry string etc. in
the face of the transformations toLanguageTag performs.

A few tests were changed, but for the better.

The tagalog -> filipino charlie foxtrot will be dealt with
in a follow up change.

Co-Authored-By: Narayan Kamath <narayan@google.com>

Change-Id: Ia7f26d92a0e38c4bbb1d839c0fbd8ad16a473bf5
de0eb683370d789e7bb25673b350b8dbf2ba5d69 11-Apr-2014 Narayan Kamath <narayan@google.com> Set ICU's default locale from Locale.getDefault.

bug: 2541757
Change-Id: I5de58be7e8a701f2c40182ea54bceff85ec1aad2
d627bd4525e41b0503f94c2887c3e01618c73105 10-Mar-2014 Neil Fuller <nfuller@google.com> Add Currency.getNumericCode()

getNumericCode() was added in Java 1.7. It returns the ISO 4217
numeric code for a currency.

Change-Id: I8404703e749b3324bbcb89ecf6d8d64b95a030a3
1529d6748e7cfcc7c1bbc28dd5fa423b1c4a2bf9 06-Feb-2014 Narayan Kamath <narayan@google.com> Make ICU.localeFromIcuLocaleId public.

This was package private for testing, but the CTS runner
uses different class loaders for the implementation and
the test so that's not good enough.

bug: 12905565

(cherry-picked from commit c92598f1b1caf2c2eaa74e94f8ee2b67e3131892)

Change-Id: I6500424333f1e6d4139bcae7339c784f7b4bcd1c
c92598f1b1caf2c2eaa74e94f8ee2b67e3131892 06-Feb-2014 Narayan Kamath <narayan@google.com> Make ICU.localeFromIcuLocaleId public.

This was package private for testing, but the CTS runner
uses different class loaders for the implementation and
the test so that's not good enough.

bug: 12905565
Change-Id: I6500424333f1e6d4139bcae7339c784f7b4bcd1c
c5b1eb191102a20bc0626aea955aba417e337fbc 10-Jan-2014 Narayan Kamath <narayan@google.com> java7: Implement new Locale APIs.

Most validation and sanity checking is performed entirely
in java. We use ICU only for converting back and forth
between Locale objects and BCP-47 language tags
(toLanguageTag & forLanguageTag).

The new APIs also add support for script subtags and
manipulation of unicode locale extensions.

Note that we do not implement
IllformedLocaleException.getErrorIndex. If anyone complains
or if it proves useful somehow, we could plumb the information
through from ICU if required.

bug: 8992787
Change-Id: I9b2d7f8d17f970d1b57111dcfe92c16e68b0fa67
2496a680ade790744df6815bbb6ed144a7028b87 31-Oct-2013 Elliott Hughes <enh@google.com> Add a cache to ICU.getBestDateTimePattern.

Brings the time down from 7ms to 7us for a cache hit on Nexus 4.

Bug: 11447043

(cherry picked from commit 0fd776f4dbf7c1940c080003f0c7a02d35374ab9)

Change-Id: I6659ff8ea29227777db0c359024f1361a7cb47e6
0fd776f4dbf7c1940c080003f0c7a02d35374ab9 31-Oct-2013 Elliott Hughes <enh@google.com> Add a cache to ICU.getBestDateTimePattern.

Brings the time down from 7ms to 7us for a cache hit on Nexus 4.

Bug: 11447043
Change-Id: I7cfc055c264ce49dadc72b5acdc2f2b0b339a5a1
0ef9944d1968207ae8501aca5f904809320c520e 19-Jun-2013 Elliott Hughes <enh@google.com> Fixes for icu4c 51.

Change getYesterdayTodayAndTomorrow to cope with the new data layout.

Extend getDateFormatOrder to cope with 'G' in fa's preferred yyyyMMdd
pattern.

Fix a few tests to correspond to data changes.

Change-Id: I2478ae960ff6ec0b9a95290132c0ae0d5d8eff5a
0604cf761b8717c025a5e78031fde1edf71c7757 30-Apr-2013 Elliott Hughes <enh@google.com> Implement getDateFormatOrder.

I do wonder if we shouldn't generalize this, rather than hard-code yMd,
but YAGNI.

Bug: 7207103
Change-Id: Ib59191eee97c08913f9a0a4ea52fb6eb8c677918
15d82808bab24f399a034d086f587d5fab32522e 27-Feb-2013 Elliott Hughes <enh@google.com> Make the CLDR version available.

Change-Id: I745b0153ae1dd9eb24dc02b19ac5ab34638a07e3
cb1b9026b8aa993785c4d54f686905522b7959b9 04-Oct-2012 Elliott Hughes <enh@google.com> Add ICU.getBestDateTimePattern.

Bug: 7204705
Change-Id: I0c65745178182f992d1d0ba0f0d56768194e2084
5ec69b20ab9b3e2dcbe225d548168b09afbbbac2 24-Jul-2012 Elliott Hughes <enh@google.com> Clean up ICU error reporting.

Throw all ICU exceptions from the native side, and include the name of the
function that failed.

Bug: 5037042
Change-Id: I49b5493a7e7365226d612479294b5b8f47ec4e8c
4c94a6128d1fcfaa75539b36c9f50d0c75df6144 16-Jun-2011 Fabrice Di Meglio <fdimeglio@google.com> Add ICU.getScript()

- needed for RTL support

Change-Id: I03796c25b965403432b79f21ef8ce2f3a4f5566a
0452e9adf6fb133b6d3e59ebae2135aa90ad0d5e 08-Jun-2011 Fabrice Di Meglio <fdimeglio@google.com> Add addLikelySubtags() to ICU

Change-Id: Ied6149b68452db879c902b544b5b69802e35ff8e
0ad1c14261c4db0731503770ec6a027e90cc6e38 04-Mar-2011 Elliott Hughes <enh@google.com> Add new java.util.Currency functionality.

Also clean up the implementation a bit, fix a long-standing
serialization bug, and improve the documentation.

Bug: 3484927
Change-Id: I5e5270b1b1cdac69b6d7f51b8460896692040a12
20998b1075a200ea844bcbd5a1851c8c5d0afb32 19-Feb-2011 Elliott Hughes <enh@google.com> Cope with ICU reporting obsolete language codes.

java.util.Locale mangles the new language codes for Hebrew and Indonesian into
the obsolete codes. I've added the ICU aliases so that ICU knows about the
obsolete codes (so that when we pass a mangled locale to ICU, ICU knows what
we're talking about). This patch adds tests, and also filters out the
duplicates caused by ICU now reporting both "he" and "iw", which we mangle
into "iw" and "iw". I've used a LinkedHashMap to preserve ICU's ordering;
there's no _need_ to do this, but it's nice behavior, better than the RI's.

Bug: 3452611
Change-Id: I6c6f3058902d5b7ee2f100605c019669da6893cd
9bbaec8f8f415244ab80061e6637c22bf40b5ccd 19-Feb-2011 Elliott Hughes <enh@google.com> Cope with ICU reporting obsolete language codes.

java.util.Locale mangles the new language codes for Hebrew and Indonesian into
the obsolete codes. I've added the ICU aliases so that ICU knows about the
obsolete codes (so that when we pass a mangled locale to ICU, ICU knows what
we're talking about). This patch adds tests, and also filters out the
duplicates caused by ICU now reporting both "he" and "iw", which we mangle
into "iw" and "iw". I've used a LinkedHashMap to preserve ICU's ordering;
there's no _need_ to do this, but it's nice behavior, better than the RI's.

Bug: 3452611
Change-Id: I320ede1a35c9dd5578116499d33a7172f27e95f5
e0e567287e4392bebc5f5826b8ef3b1bd8ca166e 11-Feb-2011 Elliott Hughes <enh@google.com> Add system properties that report our ICU4C and Unicode versions.

Bug: 3413364
Change-Id: Ibbc4ab3564bc3329275a1a828f86750aa6beb200
162b0775772fa66b7eb634760a8159a60c1ddcea 02-Oct-2010 Elliott Hughes <enh@google.com> Move more stuff out of icu4jni; ICU and LocaleData.

Bug: 3045778
Change-Id: I59fd27920a2da9a42b29fd79b8d81bdaabdef8cd