LocaleData.java revision c4e0797a4dd028d23e788da15c3055f83f6f37d5
133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes/* 233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * Copyright (C) 2009 The Android Open Source Project 333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * 433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * you may not use this file except in compliance with the License. 633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * You may obtain a copy of the License at 733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * 833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * 1033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * Unless required by applicable law or agreed to in writing, software 1133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 1233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * See the License for the specific language governing permissions and 1433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * limitations under the License. 1533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes */ 1633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes 17162b0775772fa66b7eb634760a8159a60c1ddceaElliott Hughespackage libcore.icu; 1833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes 196ca85c49efc0f02d69933f60b207b964a999061fElliott Hughesimport java.text.DateFormat; 20deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughesimport java.util.Arrays; 21757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughesimport java.util.HashMap; 22757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughesimport java.util.Locale; 236ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes 2433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes/** 2533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * Passes locale-specific from ICU native code to Java. 2633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * <p> 2733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * Note that you share these; you must not alter any of the fields, nor their array elements 2833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * in the case of arrays. If you ever expose any of these things to user code, you must give 2933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes * them a clone rather than the original. 3033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes */ 319672b4887f2972c1b7c5f3d1a6cf882deccf857fElliott Hughespublic final class LocaleData { 32757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // A cache for the locale-specific data. 33757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes private static final HashMap<String, LocaleData> localeDataCache = new HashMap<String, LocaleData>(); 34e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes static { 35e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes // Ensure that we pull in the locale data for the root locale, en_US, and the 36e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes // user's default locale. (All devices must support the root locale and en_US, 37e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes // and they're used for various system things like HTTP headers.) Pre-populating 38e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes // the cache is especially useful on Android because we'll share this via the Zygote. 39e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes get(Locale.ROOT); 40e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes get(Locale.US); 41e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes get(Locale.getDefault()); 42e2377cdd707b830d07a5708216834f7ac76ee3e1Elliott Hughes } 43757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 44143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes // Used by Calendar. 4533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public Integer firstDayOfWeek; 4633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public Integer minimalDaysInFirstWeek; 47757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 48143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes // Used by DateFormatSymbols. 49ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] amPm; // "AM", "PM". 50ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] eras; // "BC", "AD". 51757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 52ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] longMonthNames; // "January", ... 53ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] shortMonthNames; // "Jan", ... 54ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] tinyMonthNames; // "J", ... 55ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] longStandAloneMonthNames; // "January", ... 56ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] shortStandAloneMonthNames; // "Jan", ... 57ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] tinyStandAloneMonthNames; // "J", ... 58757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 59ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] longWeekdayNames; // "Sunday", ... 60ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] shortWeekdayNames; // "Sun", ... 61ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] tinyWeekdayNames; // "S", ... 62ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] longStandAloneWeekdayNames; // "Sunday", ... 63ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] shortStandAloneWeekdayNames; // "Sun", ... 64ad66a888b2e48b1a185de1b3c73fd01383a1fd04Elliott Hughes public String[] tinyStandAloneWeekdayNames; // "S", ... 65757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 66c4e0797a4dd028d23e788da15c3055f83f6f37d5Elliott Hughes // Used by frameworks/base DateSorter and DateUtils. 67c4e0797a4dd028d23e788da15c3055f83f6f37d5Elliott Hughes public String yesterday; // "Yesterday". 68c4e0797a4dd028d23e788da15c3055f83f6f37d5Elliott Hughes public String today; // "Today". 69c4e0797a4dd028d23e788da15c3055f83f6f37d5Elliott Hughes public String tomorrow; // "Tomorrow". 70c4e0797a4dd028d23e788da15c3055f83f6f37d5Elliott Hughes 7133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String fullTimeFormat; 7233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String longTimeFormat; 7333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String mediumTimeFormat; 7433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String shortTimeFormat; 75757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 7633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String fullDateFormat; 7733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String longDateFormat; 7833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String mediumDateFormat; 7933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String shortDateFormat; 80757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 81143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes // Used by DecimalFormatSymbols. 82b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char zeroDigit; 83b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char decimalSeparator; 84b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char groupingSeparator; 85b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char patternSeparator; 86b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char percent; 87b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char perMill; 88b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char monetarySeparator; 89b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes public char minusSign; 9090aa512eb7b126deb8d752b7474c30d3f73507b2Elliott Hughes public String exponentSeparator; 9133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String infinity; 9233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String NaN; 93143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes // Also used by Currency. 9433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String currencySymbol; 9533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String internationalCurrencySymbol; 96757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 97143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes // Used by DecimalFormat and NumberFormat. 9833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String numberPattern; 9933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String integerPattern; 10033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String currencyPattern; 10133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes public String percentPattern; 102757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 103757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes private LocaleData() { 104757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 105757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 106757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes /** 107757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes * Returns a shared LocaleData for the given locale. 108757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes */ 109757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes public static LocaleData get(Locale locale) { 110757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes if (locale == null) { 111757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes locale = Locale.getDefault(); 112757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 113757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes String localeName = locale.toString(); 114757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes synchronized (localeDataCache) { 115757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes LocaleData localeData = localeDataCache.get(localeName); 116757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes if (localeData != null) { 117757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes return localeData; 118757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 119757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 1205b7b7fe6a817fdf058eefd9a716cc58a3283eb05claireho LocaleData newLocaleData = initLocaleData(locale); 121757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes synchronized (localeDataCache) { 122757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes LocaleData localeData = localeDataCache.get(localeName); 123757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes if (localeData != null) { 124757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes return localeData; 125757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 126757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes localeDataCache.put(localeName, newLocaleData); 127757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes return newLocaleData; 128757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 129757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 130757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 13133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes @Override public String toString() { 13233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes return "LocaleData[" + 13333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "firstDayOfWeek=" + firstDayOfWeek + "," + 13433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "minimalDaysInFirstWeek=" + minimalDaysInFirstWeek + "," + 135deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes "amPm=" + Arrays.toString(amPm) + "," + 136deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes "eras=" + Arrays.toString(eras) + "," + 137deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes "longMonthNames=" + Arrays.toString(longMonthNames) + "," + 138deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes "shortMonthNames=" + Arrays.toString(shortMonthNames) + "," + 139143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes "longStandAloneMonthNames=" + Arrays.toString(longStandAloneMonthNames) + "," + 140143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes "shortStandAloneMonthNames=" + Arrays.toString(shortStandAloneMonthNames) + "," + 141deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes "longWeekdayNames=" + Arrays.toString(longWeekdayNames) + "," + 142deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes "shortWeekdayNames=" + Arrays.toString(shortWeekdayNames) + "," + 143143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes "longStandAloneWeekdayNames=" + Arrays.toString(longStandAloneWeekdayNames) + "," + 144143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes "shortStandAloneWeekdayNames=" + Arrays.toString(shortStandAloneWeekdayNames) + "," + 14533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "fullTimeFormat=" + fullTimeFormat + "," + 14633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "longTimeFormat=" + longTimeFormat + "," + 14733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "mediumTimeFormat=" + mediumTimeFormat + "," + 14833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "shortTimeFormat=" + shortTimeFormat + "," + 14933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "fullDateFormat=" + fullDateFormat + "," + 15033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "longDateFormat=" + longDateFormat + "," + 15133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "mediumDateFormat=" + mediumDateFormat + "," + 15233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "shortDateFormat=" + shortDateFormat + "," + 153b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "zeroDigit=" + zeroDigit + "," + 154b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "decimalSeparator=" + decimalSeparator + "," + 155b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "groupingSeparator=" + groupingSeparator + "," + 156b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "patternSeparator=" + patternSeparator + "," + 157b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "percent=" + percent + "," + 158b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "perMill=" + perMill + "," + 159b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "monetarySeparator=" + monetarySeparator + "," + 160b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes "minusSign=" + minusSign + "," + 16190aa512eb7b126deb8d752b7474c30d3f73507b2Elliott Hughes "exponentSeparator=" + exponentSeparator + "," + 16233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "infinity=" + infinity + "," + 16333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "NaN=" + NaN + "," + 16433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "currencySymbol=" + currencySymbol + "," + 16533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "internationalCurrencySymbol=" + internationalCurrencySymbol + "," + 16633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "numberPattern=" + numberPattern + "," + 16733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "integerPattern=" + integerPattern + "," + 16833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "currencyPattern=" + currencyPattern + "," + 16933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes "percentPattern=" + percentPattern + "]"; 17033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes } 171757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 1726ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes public String getDateFormat(int style) { 1736ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes switch (style) { 1746ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.SHORT: 1756ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return shortDateFormat; 1766ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.MEDIUM: 1776ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return mediumDateFormat; 1786ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.LONG: 1796ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return longDateFormat; 1806ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.FULL: 1816ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return fullDateFormat; 1826ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes } 1836ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes throw new AssertionError(); 1846ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes } 185757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 1866ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes public String getTimeFormat(int style) { 1876ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes switch (style) { 1886ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.SHORT: 1896ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return shortTimeFormat; 1906ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.MEDIUM: 1916ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return mediumTimeFormat; 1926ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.LONG: 1936ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return longTimeFormat; 1946ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes case DateFormat.FULL: 1956ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes return fullTimeFormat; 1966ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes } 1976ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes throw new AssertionError(); 1986ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes } 199757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes 200757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes private static LocaleData initLocaleData(Locale locale) { 201757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes LocaleData localeData = new LocaleData(); 202757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes if (!ICU.initLocaleDataImpl(locale.toString(), localeData)) { 203757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes throw new AssertionError("couldn't initialize LocaleData for locale " + locale); 204757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 205757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes if (localeData.fullTimeFormat != null) { 206757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // There are some full time format patterns in ICU that use the pattern character 'v'. 207757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // Java doesn't accept this, so we replace it with 'z' which has about the same result 208757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // as 'v', the timezone name. 209757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // 'v' -> "PT", 'z' -> "PST", v is the generic timezone and z the standard tz 210757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // "vvvv" -> "Pacific Time", "zzzz" -> "Pacific Standard Time" 211757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes localeData.fullTimeFormat = localeData.fullTimeFormat.replace('v', 'z'); 212757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 213757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes if (localeData.numberPattern != null) { 214757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // The number pattern might contain positive and negative subpatterns. Arabic, for 215757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // example, might look like "#,##0.###;#,##0.###-" because the minus sign should be 216757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // written last. Macedonian supposedly looks something like "#,##0.###;(#,##0.###)". 217757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // (The negative subpattern is optional, though, and not present in most locales.) 218757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // By only swallowing '#'es and ','s after the '.', we ensure that we don't 219757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes // accidentally eat too much. 220757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes localeData.integerPattern = localeData.numberPattern.replaceAll("\\.[#,]*", ""); 221757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 222757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes return localeData; 223757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes } 22433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes} 225