LocaleData.java revision 5b7b7fe6a817fdf058eefd9a716cc58a3283eb05
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.
4933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String[] amPm;
5033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String[] eras;
51757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
5233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String[] longMonthNames;
5333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String[] shortMonthNames;
54143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes    public String[] longStandAloneMonthNames;
55143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes    public String[] shortStandAloneMonthNames;
56757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
5733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String[] longWeekdayNames;
5833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String[] shortWeekdayNames;
59143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes    public String[] longStandAloneWeekdayNames;
60143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes    public String[] shortStandAloneWeekdayNames;
61757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
6233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String fullTimeFormat;
6333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String longTimeFormat;
6433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String mediumTimeFormat;
6533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String shortTimeFormat;
66757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
6733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String fullDateFormat;
6833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String longDateFormat;
6933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String mediumDateFormat;
7033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String shortDateFormat;
71757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
72143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes    // Used by DecimalFormatSymbols.
73b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char zeroDigit;
74b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char decimalSeparator;
75b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char groupingSeparator;
76b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char patternSeparator;
77b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char percent;
78b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char perMill;
79b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char monetarySeparator;
80b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes    public char minusSign;
8190aa512eb7b126deb8d752b7474c30d3f73507b2Elliott Hughes    public String exponentSeparator;
8233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String infinity;
8333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String NaN;
84143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes    // Also used by Currency.
8533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String currencySymbol;
8633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String internationalCurrencySymbol;
87757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
88143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes    // Used by DecimalFormat and NumberFormat.
8933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String numberPattern;
9033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String integerPattern;
9133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String currencyPattern;
9233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    public String percentPattern;
93757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
94757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes    private LocaleData() {
95757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes    }
96757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
97757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes    /**
98757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes     * Returns a shared LocaleData for the given locale.
99757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes     */
100757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes    public static LocaleData get(Locale locale) {
101757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        if (locale == null) {
102757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            locale = Locale.getDefault();
103757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        }
104757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        String localeName = locale.toString();
105757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        synchronized (localeDataCache) {
106757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            LocaleData localeData = localeDataCache.get(localeName);
107757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            if (localeData != null) {
108757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes                return localeData;
109757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            }
110757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        }
1115b7b7fe6a817fdf058eefd9a716cc58a3283eb05claireho        LocaleData newLocaleData = initLocaleData(locale);
112757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        synchronized (localeDataCache) {
113757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            LocaleData localeData = localeDataCache.get(localeName);
114757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            if (localeData != null) {
115757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes                return localeData;
116757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            }
117757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            localeDataCache.put(localeName, newLocaleData);
118757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            return newLocaleData;
119757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        }
120757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes    }
121757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
12233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    @Override public String toString() {
12333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes        return "LocaleData[" +
12433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "firstDayOfWeek=" + firstDayOfWeek + "," +
12533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "minimalDaysInFirstWeek=" + minimalDaysInFirstWeek + "," +
126deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes                "amPm=" + Arrays.toString(amPm) + "," +
127deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes                "eras=" + Arrays.toString(eras) + "," +
128deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes                "longMonthNames=" + Arrays.toString(longMonthNames) + "," +
129deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes                "shortMonthNames=" + Arrays.toString(shortMonthNames) + "," +
130143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes                "longStandAloneMonthNames=" + Arrays.toString(longStandAloneMonthNames) + "," +
131143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes                "shortStandAloneMonthNames=" + Arrays.toString(shortStandAloneMonthNames) + "," +
132deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes                "longWeekdayNames=" + Arrays.toString(longWeekdayNames) + "," +
133deacd761e85ee4d75a6adbdd63225fc4a6d3088dElliott Hughes                "shortWeekdayNames=" + Arrays.toString(shortWeekdayNames) + "," +
134143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes                "longStandAloneWeekdayNames=" + Arrays.toString(longStandAloneWeekdayNames) + "," +
135143e8c9cf91cfc01c3c91c8e93cad661ec7554eeElliott Hughes                "shortStandAloneWeekdayNames=" + Arrays.toString(shortStandAloneWeekdayNames) + "," +
13633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "fullTimeFormat=" + fullTimeFormat + "," +
13733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "longTimeFormat=" + longTimeFormat + "," +
13833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "mediumTimeFormat=" + mediumTimeFormat + "," +
13933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "shortTimeFormat=" + shortTimeFormat + "," +
14033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "fullDateFormat=" + fullDateFormat + "," +
14133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "longDateFormat=" + longDateFormat + "," +
14233aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "mediumDateFormat=" + mediumDateFormat + "," +
14333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "shortDateFormat=" + shortDateFormat + "," +
144b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "zeroDigit=" + zeroDigit + "," +
145b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "decimalSeparator=" + decimalSeparator + "," +
146b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "groupingSeparator=" + groupingSeparator + "," +
147b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "patternSeparator=" + patternSeparator + "," +
148b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "percent=" + percent + "," +
149b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "perMill=" + perMill + "," +
150b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "monetarySeparator=" + monetarySeparator + "," +
151b7e820b92c7345cdc0cd4fea50954289ae66eb67Elliott Hughes                "minusSign=" + minusSign + "," +
15290aa512eb7b126deb8d752b7474c30d3f73507b2Elliott Hughes                "exponentSeparator=" + exponentSeparator + "," +
15333aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "infinity=" + infinity + "," +
15433aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "NaN=" + NaN + "," +
15533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "currencySymbol=" + currencySymbol + "," +
15633aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "internationalCurrencySymbol=" + internationalCurrencySymbol + "," +
15733aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "numberPattern=" + numberPattern + "," +
15833aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "integerPattern=" + integerPattern + "," +
15933aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "currencyPattern=" + currencyPattern + "," +
16033aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes                "percentPattern=" + percentPattern + "]";
16133aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes    }
162757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
1636ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes    public String getDateFormat(int style) {
1646ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        switch (style) {
1656ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.SHORT:
1666ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return shortDateFormat;
1676ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.MEDIUM:
1686ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return mediumDateFormat;
1696ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.LONG:
1706ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return longDateFormat;
1716ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.FULL:
1726ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return fullDateFormat;
1736ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        }
1746ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        throw new AssertionError();
1756ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes    }
176757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
1776ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes    public String getTimeFormat(int style) {
1786ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        switch (style) {
1796ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.SHORT:
1806ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return shortTimeFormat;
1816ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.MEDIUM:
1826ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return mediumTimeFormat;
1836ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.LONG:
1846ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return longTimeFormat;
1856ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        case DateFormat.FULL:
1866ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes            return fullTimeFormat;
1876ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        }
1886ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes        throw new AssertionError();
1896ca85c49efc0f02d69933f60b207b964a999061fElliott Hughes    }
190757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes
191757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes    private static LocaleData initLocaleData(Locale locale) {
192757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        LocaleData localeData = new LocaleData();
193757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        if (!ICU.initLocaleDataImpl(locale.toString(), localeData)) {
194757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            throw new AssertionError("couldn't initialize LocaleData for locale " + locale);
195757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        }
196757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        if (localeData.fullTimeFormat != null) {
197757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // There are some full time format patterns in ICU that use the pattern character 'v'.
198757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // Java doesn't accept this, so we replace it with 'z' which has about the same result
199757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // as 'v', the timezone name.
200757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // 'v' -> "PT", 'z' -> "PST", v is the generic timezone and z the standard tz
201757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // "vvvv" -> "Pacific Time", "zzzz" -> "Pacific Standard Time"
202757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            localeData.fullTimeFormat = localeData.fullTimeFormat.replace('v', 'z');
203757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        }
204757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        if (localeData.numberPattern != null) {
205757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // The number pattern might contain positive and negative subpatterns. Arabic, for
206757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // example, might look like "#,##0.###;#,##0.###-" because the minus sign should be
207757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // written last. Macedonian supposedly looks something like "#,##0.###;(#,##0.###)".
208757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // (The negative subpattern is optional, though, and not present in most locales.)
209757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // By only swallowing '#'es and ','s after the '.', we ensure that we don't
210757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            // accidentally eat too much.
211757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes            localeData.integerPattern = localeData.numberPattern.replaceAll("\\.[#,]*", "");
212757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        }
213757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes        return localeData;
214757a7942eed2b0aa457f8517a0259d2ac82c5b18Elliott Hughes    }
21533aa6eb602478e7f51ac16f30c88db3566022886Elliott Hughes}
216