Home
last modified time | relevance | path

Searched refs:locale (Results 1 – 25 of 177) sorted by relevance

12345678

/libcore/ojluni/src/test/java/time/test/java/util/
DTestFormatter.java120 for (Locale locale : locales) { in test()
122 testDate(fmtStr, locale, zdt, cal); in test()
125 testTime(fmtStr, locale, zdt, cal); in test()
127 testZoneId(locale, zdt, cal); in test()
128 testInstant(locale, instant, zdt, cal); in test()
158 private String test(String fmtStr, Locale locale, in test() argument
161 new StringBuilder(), locale).format(fmtStr, dt).out().toString(); in test()
213 private void printFmtStr(Locale locale, String fmtStr) { in printFmtStr() argument
216 System.out.printf("[%s, %s]%n", locale.toString(), fmtStr); in printFmtStr()
220 private void testDate(String fmtStr, Locale locale, in testDate() argument
[all …]
/libcore/luni/src/main/java/libcore/icu/
DLocaleData.java27 import sun.util.locale.provider.CalendarDataUtility;
147 public static Locale mapInvalidAndNullLocales(Locale locale) { in mapInvalidAndNullLocales() argument
148 if (locale == null) { in mapInvalidAndNullLocales()
152 if ("und".equals(locale.toLanguageTag())) { in mapInvalidAndNullLocales()
156 return locale; in mapInvalidAndNullLocales()
165 public static Locale getCompatibleLocaleForBug159514442(Locale locale) { in getCompatibleLocaleForBug159514442() argument
166 if (Locale.ROOT.equals(locale)) { in getCompatibleLocaleForBug159514442()
172 locale = LOCALE_EN_US_POSIX; in getCompatibleLocaleForBug159514442()
175 return locale; in getCompatibleLocaleForBug159514442()
182 public static LocaleData get(Locale locale) { in get() argument
[all …]
DSimpleDateFormatData.java26 import sun.util.locale.LanguageTag;
40 private final Locale locale; field in SimpleDateFormatData
54 private SimpleDateFormatData(Locale locale) { in SimpleDateFormatData() argument
55 this.locale = locale; in SimpleDateFormatData()
56 this.usesAsciiSpace = isBug266731719Locale(locale); in SimpleDateFormatData()
58 ExtendedCalendar calendar = ICU.getExtendedCalendar(locale, "gregorian"); in SimpleDateFormatData()
97 public static SimpleDateFormatData getInstance(Locale locale) { in getInstance() argument
98 Objects.requireNonNull(locale, "locale can't be null"); in getInstance()
100 locale = LocaleData.getCompatibleLocaleForBug159514442(locale); in getInstance()
102 final String languageTag = locale.toLanguageTag(); in getInstance()
[all …]
DDecimalFormatData.java58 private DecimalFormatData(Locale locale) { in DecimalFormatData() argument
59 DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale); in DecimalFormatData()
74 patternSeparator = loadPatternSeparator(locale); in DecimalFormatData()
77 locale, NumberFormat.NUMBERSTYLE); in DecimalFormatData()
80 df = (DecimalFormat) NumberFormat.getInstance(locale, NumberFormat.CURRENCYSTYLE); in DecimalFormatData()
83 df = (DecimalFormat) NumberFormat.getInstance(locale, NumberFormat.PERCENTSTYLE); in DecimalFormatData()
94 public static DecimalFormatData getInstance(Locale locale) { in getInstance() argument
95 Objects.requireNonNull(locale, "locale can't be null"); in getInstance()
97 locale = LocaleData.getCompatibleLocaleForBug159514442(locale); in getInstance()
99 final String languageTag = locale.toLanguageTag(); in getInstance()
[all …]
DICU.java75 for (Locale locale : new Locale[] {Locale.US, Locale.getDefault()}) { in initializeCacheInZygote()
76 getTimePattern(locale, false, false); in initializeCacheInZygote()
77 getTimePattern(locale, false, true); in initializeCacheInZygote()
78 getTimePattern(locale, true, false); in initializeCacheInZygote()
79 getTimePattern(locale, true, true); in initializeCacheInZygote()
327 /* package */ static String getTimePattern(Locale locale, boolean is24Hour, boolean withSecond) { in getTimePattern() argument
334 return getBestDateTimePattern(skeleton, locale); in getTimePattern()
341 public static String getBestDateTimePattern(String skeleton, Locale locale) { in getBestDateTimePattern() argument
342 String languageTag = locale.toLanguageTag(); in getBestDateTimePattern()
347 pattern = getBestDateTimePattern0(skeleton, locale); in getBestDateTimePattern()
[all …]
/libcore/ojluni/src/test/java/time/test/java/time/format/
DTestZoneTextPrinterParser.java62 protected static DateTimeFormatter getFormatter(Locale locale, TextStyle style) { in getFormatter() argument
64 .toFormatter(locale) in getFormatter()
65 .withDecimalStyle(DecimalStyle.of(locale)); in getFormatter()
101 for (Locale locale : locales) { in test_printText()
103 if (locale.getLanguage().equals("ji")) { in test_printText()
122 printText(locale, zdt, TextStyle.FULL, tz, in test_printText()
123 tz.getDisplayName(isDST, TimeZone.LONG, locale)); in test_printText()
124 printText(locale, zdt, TextStyle.SHORT, tz, in test_printText()
125 tz.getDisplayName(isDST, TimeZone.SHORT, locale)); in test_printText()
145 …private void printText(Locale locale, ZonedDateTime zdt, TextStyle style, TimeZone zone, String ex… in printText() argument
[all …]
DAbstractTestPrinterParser.java87 protected Locale locale; field in AbstractTestPrinterParser
96 locale = Locale.ENGLISH; in setUp()
117 return builder.toFormatter(locale).withDecimalStyle(decimalStyle); in getFormatter()
121 return builder.appendLiteral(c).toFormatter(locale).withDecimalStyle(decimalStyle); in getFormatter()
125 return builder.appendLiteral(s).toFormatter(locale).withDecimalStyle(decimalStyle); in getFormatter()
129 return builder.appendText(field).toFormatter(locale).withDecimalStyle(decimalStyle); in getFormatter()
133 return builder.appendText(field, style).toFormatter(locale).withDecimalStyle(decimalStyle); in getFormatter()
137 …return builder.appendValue(field, minWidth, maxWidth, signStyle).toFormatter(locale).withDecimalSt… in getFormatter()
141 …return builder.appendOffset(pattern, noOffsetText).toFormatter(locale).withDecimalStyle(decimalSty… in getFormatter()
145 return builder.appendPattern(pattern).toFormatter(locale).withDecimalStyle(decimalStyle); in getPatternFormatter()
/libcore/ojluni/src/main/java/sun/util/locale/
DBaseLocale.java33 package sun.util.locale;
191 private Key(BaseLocale locale) { in Key() argument
192 this.holder = locale; in Key()
195 String language = locale.getLanguage(); in Key()
196 String region = locale.getRegion(); in Key()
199 && locale.getVariant() == "" in Key()
200 && locale.getScript() == ""; in Key()
227 BaseLocale locale = new BaseLocale(language, script, region, variant, normalize); in Key() local
230 this.holderRef = new SoftReference<>(locale); in Key()
234 this.holder = locale; in Key()
[all …]
/libcore/luni/src/test/java/libcore/highmemorytest/java/text/
DDateFormatTest.java48 public Locale locale; field in DateFormatTest
61 assertNonEmpty(DateFormat.getDateInstance(formatStyle, locale).format(TEST_DATE)); in test_format_allLocales()
62 assertNonEmpty(DateFormat.getTimeInstance(formatStyle, locale).format(TEST_DATE)); in test_format_allLocales()
63 assertNonEmpty(DateFormat.getDateTimeInstance(formatStyle, formatStyle, locale) in test_format_allLocales()
66 throw new RuntimeException("locale:" + locale + in test_format_allLocales()
80 assertSupportedSymbols(DateFormat.getDateInstance(formatStyle, locale), locale); in test_toPattern_allLocales() local
81 assertSupportedSymbols(DateFormat.getTimeInstance(formatStyle, locale), locale); in test_toPattern_allLocales() local
83 formatStyle, formatStyle, locale), locale); in test_toPattern_allLocales() local
85 throw new RuntimeException("locale:" + locale + in test_toPattern_allLocales()
95 private static void assertSupportedSymbols(DateFormat dateFormat, Locale locale) { in assertSupportedSymbols() argument
[all …]
DDecimalFormatTest.java44 public Locale locale; field in DecimalFormatTest
52 for (Locale locale : Locale.getAvailableLocales()) { in testCurrencySymbolSpacing()
53 DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale); in testCurrencySymbolSpacing()
56 assertCurrencyFormat("USD" + formattedZero, "\u00a4\u00a40", dfs, currency, locale); in testCurrencySymbolSpacing()
57 assertCurrencyFormat(formattedZero + "USD", "0\u00a4\u00a4", dfs, currency, locale); in testCurrencySymbolSpacing()
58 assertCurrencyFormat(currency.getSymbol(locale) + formattedZero, "\u00a40", dfs, in testCurrencySymbolSpacing()
59 currency, locale); in testCurrencySymbolSpacing() local
60 assertCurrencyFormat(formattedZero + currency.getSymbol(locale), "0\u00a4", dfs, in testCurrencySymbolSpacing()
61 currency, locale); in testCurrencySymbolSpacing()
66 DecimalFormatSymbols dfs, Currency currency, Locale locale) { in assertCurrencyFormat() argument
[all …]
/libcore/ojluni/src/main/java/sun/util/locale/provider/
DCalendarDataUtility.java26 package sun.util.locale.provider;
83 public static int retrieveFirstDayOfWeek(Locale locale, int defaultFirstDayOfWeek) { in retrieveFirstDayOfWeek() argument
85 if (locale.hasExtensions()) { in retrieveFirstDayOfWeek()
86 String fw = locale.getUnicodeLocaleType("fw"); in retrieveFirstDayOfWeek()
142 Locale locale) { in retrieveFieldValueName() argument
165 String[] names = getNames(id, field, style, locale); in retrieveFieldValueName()
189 Locale locale) { in retrieveJavaTimeFieldValueName() argument
191 return retrieveFieldValueName(id, field, value, style, locale); in retrieveJavaTimeFieldValueName()
205 Locale locale) { in retrieveFieldValueNames() argument
208 names = retrieveFieldValueNamesImpl(id, field, SHORT_FORMAT, locale); in retrieveFieldValueNames()
[all …]
/libcore/ojluni/src/main/java/java/text/
DBreakIterator.java454 public static BreakIterator getWordInstance(Locale locale) in getWordInstance() argument
458 android.icu.text.BreakIterator.getWordInstance(locale)); in getWordInstance()
480 public static BreakIterator getLineInstance(Locale locale) in getLineInstance() argument
484 android.icu.text.BreakIterator.getLineInstance(locale)); in getLineInstance()
506 public static BreakIterator getCharacterInstance(Locale locale) in getCharacterInstance() argument
510 android.icu.text.BreakIterator.getCharacterInstance(locale)); in getCharacterInstance()
532 public static BreakIterator getSentenceInstance(Locale locale) in getSentenceInstance() argument
536 android.icu.text.BreakIterator.getSentenceInstance(locale)); in getSentenceInstance()
DDateFormatSymbols.java143 public DateFormatSymbols(Locale locale) in DateFormatSymbols() argument
145 initializeData(locale); in DateFormatSymbols()
286 Locale locale = null; field in DateFormatSymbols
411 public static final DateFormatSymbols getInstance(Locale locale) { in getInstance() argument
413 return (DateFormatSymbols) getCachedInstance(locale).clone(); in getInstance()
422 static final DateFormatSymbols getInstanceRef(Locale locale) { in getInstanceRef() argument
424 return getCachedInstance(locale); in getInstanceRef()
435 private static DateFormatSymbols getCachedInstance(Locale locale) { in getCachedInstance() argument
436 Locale cacheKey = LocaleData.getCompatibleLocaleForBug159514442(locale); in getCachedInstance()
440 dfs = new DateFormatSymbols(locale); in getCachedInstance()
[all …]
DDecimalFormatSymbols.java51 import sun.util.locale.provider.CalendarDataUtility;
110 public DecimalFormatSymbols( Locale locale ) { in DecimalFormatSymbols() argument
111 initialize( locale ); in DecimalFormatSymbols()
166 public static final DecimalFormatSymbols getInstance(Locale locale) { in getInstance() argument
168 return new DecimalFormatSymbols(locale); in getInstance()
413 initializeCurrency(locale); in getCurrencySymbol()
426 initializeCurrency(locale); in setCurrencySymbol()
442 initializeCurrency(locale); in getInternationalCurrencySymbol()
464 initializeCurrency(locale); in setInternationalCurrencySymbol()
472 currencySymbol = currency.getSymbol(locale); in setInternationalCurrencySymbol()
[all …]
DMessageFormat.java371 this.locale = Locale.getDefault(Locale.Category.FORMAT); in MessageFormat()
390 public MessageFormat(String pattern, Locale locale) { in MessageFormat() argument
391 this.locale = locale; in MessageFormat()
412 public void setLocale(Locale locale) { in setLocale() argument
413 this.locale = locale; in setLocale()
422 return locale; in getLocale()
547 if (fmt.equals(NumberFormat.getInstance(locale))) { in toPattern()
549 } else if (fmt.equals(NumberFormat.getCurrencyInstance(locale))) { in toPattern()
551 } else if (fmt.equals(NumberFormat.getPercentInstance(locale))) { in toPattern()
553 } else if (fmt.equals(NumberFormat.getIntegerInstance(locale))) { in toPattern()
[all …]
/libcore/ojluni/src/main/java/java/util/
DResourceBundle.java69 import sun.util.locale.BaseLocale;
70 import sun.util.locale.LocaleObjectCache;
391 private Locale locale = null; field in ResourceBundle
493 return locale; in getLocale()
591 private volatile Locale locale; field in ResourceBundle.CacheKey
631 CacheKey(String baseName, Locale locale, ClassLoader loader) { in CacheKey() argument
636 this.locale = locale; in CacheKey()
659 this.locale = src.locale; in CacheKey()
678 return locale; in getLocale()
681 CacheKey setLocale(Locale locale) { in setLocale() argument
[all …]
DCurrency.java353 public static Currency getInstance(Locale locale) { in getInstance() argument
355 String override = locale.getUnicodeLocaleType("cu"); in getInstance()
406 String country = locale.getCountry(); in getInstance()
408 android.icu.util.Currency.getInstance(locale); in getInstance()
412 String variant = locale.getVariant(); in getInstance()
419 throw new IllegalArgumentException("Unsupported ISO 3166 country: " + locale); in getInstance()
546 public String getSymbol(Locale locale) { in getSymbol() argument
562 if (locale == null) { in getSymbol()
565 return icuCurrency.getSymbol(locale); in getSymbol()
660 public String getDisplayName(Locale locale) { in getDisplayName() argument
[all …]
/libcore/benchmarks/src_androidx/libcore/benchmark/
DFormatterTest.java38 for (Locale locale : Locale.getAvailableLocales()) { in stringFormatNumber_allLocales()
41 String.format(locale, "%d s", 0); in stringFormatNumber_allLocales()
50 for (Locale locale : Locale.getAvailableLocales()) { in stringFormatNumber_withWidth_allLocales()
51 String.format(locale, "%05d s", 123); in stringFormatNumber_withWidth_allLocales()
60 for (Locale locale : Locale.getAvailableLocales()) { in stringFormatString_allLocales()
61 String.format(locale, "foo-%s-baz", "bar"); in stringFormatString_allLocales()
/libcore/luni/src/test/java/libcore/java/text/
DDateFormatTest.java57 final Locale locale = Locale.US; in checkTimePattern() local
59 DateFormat format = DateFormat.getTimeInstance(style, locale); in checkTimePattern()
61 SimpleDateFormat sdf = new SimpleDateFormat(expectedPattern, locale); in checkTimePattern()
67 Locale locale = Locale.forLanguageTag("en-u-tz-usden"); in testGetTimeInstance_withLocaleExtension() local
68 DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, locale); in testGetTimeInstance_withLocaleExtension()
81 private static void assertParse_lenient_en(Locale locale) throws ParseException { in assertParse_lenient_en() argument
88 locale); in assertParse_lenient_en()
103 private static void assertFormat_forBug266731719(Locale locale) { in assertFormat_forBug266731719() argument
105 locale); in assertFormat_forBug266731719()
DDecimalFormatTest.java277 …erAndFractionByLocale(String value, int multiplier, int fraction, Locale locale, String expectedRe… in assertDecFmtWithMultiplierAndFractionByLocale() argument
278 DecimalFormat df = (DecimalFormat)NumberFormat.getIntegerInstance(locale); in assertDecFmtWithMultiplierAndFractionByLocale()
458 private String formatArbitraryCurrencyAmountInLocale(Currency currency, Locale locale) { in formatArbitraryCurrencyAmountInLocale() argument
459 NumberFormat localeCurrencyFormat = NumberFormat.getCurrencyInstance(locale); in formatArbitraryCurrencyAmountInLocale()
472 Locale locale = new Locale("de", "AT"); in testLocaleGroupingSeparator() local
474 new android.icu.text.DecimalFormatSymbols(locale); in testLocaleGroupingSeparator()
479 DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale); in testLocaleGroupingSeparator()
508 Locale locale; in testPerMill() local
511 locale = Locale.US; in testPerMill()
514 new android.icu.text.DecimalFormatSymbols(locale)); in testPerMill()
[all …]
/libcore/luni/src/test/java/libcore/java/util/
DOldAndroidLocaleTest.java36 Locale locale = new Locale("en"); in testLocale() local
37 assertEquals("en", locale.toString()); in testLocale()
39 locale = new Locale("en", "US"); in testLocale()
40 assertEquals("en_US", locale.toString()); in testLocale()
42 locale = new Locale("en", "", "POSIX"); in testLocale()
43 assertEquals("en__POSIX", locale.toString()); in testLocale()
45 locale = new Locale("en", "US", "POSIX"); in testLocale()
46 assertEquals("en_US_POSIX", locale.toString()); in testLocale()
DScannerTest.java32 Locale locale = Locale.forLanguageTag("zh"); in testReset() local
34 scanner.useLocale(locale); in testReset()
37 assertEquals(locale, scanner.locale()); in testReset()
42 assertEquals(Locale.getDefault(Locale.Category.FORMAT), scanner.locale()); in testReset()
/libcore/luni/src/test/java/libcore/highmemorytest/java/time/format/
DDateTimeFormatterTest.java48 public Locale locale; field in DateTimeFormatterTest
61 .withLocale(locale) in test_format_allLocales()
66 .withLocale(locale) in test_format_allLocales()
71 .withLocale(locale) in test_format_allLocales()
90 .withLocale(locale) in test_format_allLocales_allChronologies()
96 .withLocale(locale) in test_format_allLocales_allChronologies()
102 .withLocale(locale) in test_format_allLocales_allChronologies()
/libcore/benchmarks/src/benchmarks/regression/
DBreakIteratorBenchmark.java39 final Locale locale; field in BreakIteratorBenchmark.Text
42 Text(Locale locale, String text) { in Text() argument
44 this.locale = locale; in Text()
52 BreakIterator it = BreakIterator.getLineInstance(text.locale); in timeBreakIterator()
63 android.icu.text.BreakIterator.getLineInstance(text.locale); in timeIcuBreakIterator()
/libcore/ojluni/src/test/java/time/tck/java/time/format/
DTCKLocalizedPrinterParser.java146 …blic void test_date_print(LocalDate date, FormatStyle dateStyle, int dateStyleOld, Locale locale) { in test_date_print() argument
147 DateFormat old = DateFormat.getDateInstance(dateStyleOld, locale); in test_date_print()
151 DateTimeFormatter f = builder.appendLocalized(dateStyle, null).toFormatter(locale); in test_date_print()
158 …blic void test_date_parse(LocalDate date, FormatStyle dateStyle, int dateStyleOld, Locale locale) { in test_date_parse() argument
159 DateFormat old = DateFormat.getDateInstance(dateStyleOld, locale); in test_date_parse()
163 DateTimeFormatter f = builder.appendLocalized(dateStyle, null).toFormatter(locale); in test_date_parse()
199 …blic void test_time_print(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) { in test_time_print() argument
200 DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale); in test_time_print()
204 DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale); in test_time_print()
207 if (Locale.US.equals(locale)) { in test_time_print()
[all …]

12345678