Java Code Examples for com.foobar.Utils#supportsLocale()
The following examples show how to use
com.foobar.Utils#supportsLocale() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DateFormatSymbolsProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public DateFormatSymbols getInstance(Locale locale) { if (!Utils.supportsLocale(availList, locale)) { throw new IllegalArgumentException("locale is not supported: "+locale); } FooDateFormatSymbols fdfs = symbols.get(locale); if (fdfs == null) { for (int index = 0; index < avail.length; index ++) { if (Utils.supportsLocale(avail[index], locale)) { fdfs = new FooDateFormatSymbols(index); symbols.put(locale, fdfs); break; } } } return fdfs; }
Example 2
Source File: DecimalFormatSymbolsProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public DecimalFormatSymbols getInstance(Locale locale) { if (!Utils.supportsLocale(availList, locale)) { throw new IllegalArgumentException("locale is not supported: "+locale); } FooDecimalFormatSymbols fdfs = symbols.get(locale); if (fdfs == null) { for (int index = 0; index < avail.length; index ++) { if (Utils.supportsLocale(avail[index], locale)) { fdfs = new FooDecimalFormatSymbols(index); symbols.put(locale, fdfs); break; } } } return fdfs; }
Example 3
Source File: CurrencyNameProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public String getDisplayName(String c, Locale locale) { if (!Utils.supportsLocale(Arrays.asList(avail), locale)) { throw new IllegalArgumentException("locale is not supported: "+locale); } if (c.equals("JPY")) { if (Utils.supportsLocale(avail[0], locale)) { return "\u65e5\u672c\u5186\u3084\u3002"; } else if (Utils.supportsLocale(avail[1], locale)) { return "\u65e5\u672c\u5186\u3069\u3059\u3002"; } else if (Utils.supportsLocale(avail[2], locale)) { return "\u65e5\u672c\u5186\u3067\u3059\u3002"; } else if (Utils.supportsLocale(avail[3], locale)) { return "\u65e5\u672c\u5186\u3070\u3064\u3070\u3064\u3002"; } } return null; }
Example 4
Source File: TimeZoneNameProviderImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public String getDisplayName(String id, boolean dst, int style, Locale language) { if (!Utils.supportsLocale(Arrays.asList(avail), language)) { throw new IllegalArgumentException("locale is not one of available locales: "+language); } for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], language)) { String[][] namesForALocale = names[i]; for (int j = 0; j < namesForALocale.length; j++) { String[] array = namesForALocale[j]; if (id.equals(array[0])) { String ret = array[(style==TimeZone.LONG?0:1)+(dst?2:0)+1]; return ret; } } } } return null; }
Example 5
Source File: CurrencyNameProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public String getSymbol(String c, Locale locale) { if (!Utils.supportsLocale(Arrays.asList(avail), locale)) { throw new IllegalArgumentException("locale is not supported: "+locale); } if (c.equals("JPY")) { if (Utils.supportsLocale(avail[0], locale)) { return "\u5186\u3084\u3002"; } else if (Utils.supportsLocale(avail[1], locale)) { return "\u5186\u3069\u3059\u3002"; } else if (Utils.supportsLocale(avail[2], locale)) { return "\u5186\u3067\u3059\u3002"; } else if (Utils.supportsLocale(avail[3], locale)) { return "\u5186\u3070\u3064\u3070\u3064\u3002"; } } return null; }
Example 6
Source File: NumberFormatProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public NumberFormat getNumberInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { String pattern = MessageFormat.format(patterns[NUMBERSTYLE], dialect[i], dialect[i]); return new FooNumberFormat(pattern, DecimalFormatSymbols.getInstance(locale)); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 7
Source File: BreakIteratorProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public BreakIterator getCharacterInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { return new FooBreakIterator(Type.CHARACTER, i); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 8
Source File: NumberFormatProviderImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public NumberFormat getPercentInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { String pattern = MessageFormat.format(patterns[PERCENTSTYLE], dialect[i]); return new FooNumberFormat(pattern, DecimalFormatSymbols.getInstance(locale)); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 9
Source File: CalendarNameProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) { if (calendarType == null || locale == null) { throw new NullPointerException(); } if (!Utils.supportsLocale(Arrays.asList(avail), locale)) { throw new IllegalArgumentException("locale is not one of available locales: " + locale); } if (field != MONTH) { return null; } Map<String, Integer> map = new HashMap<>(); if (style == LONG_STANDALONE) { style = LONG; } else if (style == SHORT_STANDALONE) { style = SHORT; } for (int month = JANUARY; month <= DECEMBER; month++) { if (style == ALL_STYLES || style == LONG) { map.put(toMonthName(month + 1, LONG), month); } if (style == ALL_STYLES || style == SHORT) { map.put(toMonthName(month + 1, SHORT), month); } } return map; }
Example 10
Source File: NumberFormatProviderImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public NumberFormat getNumberInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { String pattern = MessageFormat.format(patterns[NUMBERSTYLE], dialect[i], dialect[i]); return new FooNumberFormat(pattern, DecimalFormatSymbols.getInstance(locale)); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 11
Source File: BreakIteratorProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public BreakIterator getCharacterInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { return new FooBreakIterator(Type.CHARACTER, i); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 12
Source File: NumberFormatProviderImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public NumberFormat getCurrencyInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { String pattern = MessageFormat.format(patterns[CURRENCYSTYLE], dialect[i], dialect[i]); FooNumberFormat nf = new FooNumberFormat(pattern, DecimalFormatSymbols.getInstance(locale)); adjustForCurrencyDefaultFractionDigits(nf); return nf; } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 13
Source File: BreakIteratorProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public BreakIterator getWordInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { return new FooBreakIterator(Type.WORD, i); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 14
Source File: BreakIteratorProviderImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public BreakIterator getCharacterInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { return new FooBreakIterator(Type.CHARACTER, i); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 15
Source File: DateFormatProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { return new FooDateFormat( datePattern[dateStyle]+" "+timePattern[timeStyle]+dialect[i], locale); } } throw new IllegalArgumentException("locale is not supported: "+locale); }
Example 16
Source File: CalendarNameProviderImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) { if (calendarType == null || locale == null) { throw new NullPointerException(); } if (!Utils.supportsLocale(Arrays.asList(avail), locale)) { throw new IllegalArgumentException("locale is not one of available locales: "+ locale); } if (field != MONTH) { return null; } return toMonthName(value + 1, style); }
Example 17
Source File: CalendarNameProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) { if (calendarType == null || locale == null) { throw new NullPointerException(); } if (!Utils.supportsLocale(Arrays.asList(avail), locale)) { throw new IllegalArgumentException("locale is not one of available locales: "+ locale); } if (field != MONTH) { return null; } return toMonthName(value + 1, style); }
Example 18
Source File: CurrencyNameProviderImpl2.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public String getSymbol(String c, Locale locale) { if (!Utils.supportsLocale(Arrays.asList(avail), locale)) { throw new IllegalArgumentException("locale is not supported: "+locale); } if (c.equals("JPY")) { if (Utils.supportsLocale(avail[0], locale)) { return "JPY-tokyo"; } else if (Utils.supportsLocale(avail[1], locale)) { return "JPY-osaka"; } } return null; }
Example 19
Source File: CalendarNameProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) { if (calendarType == null || locale == null) { throw new NullPointerException(); } if (!Utils.supportsLocale(Arrays.asList(avail), locale)) { throw new IllegalArgumentException("locale is not one of available locales: " + locale); } if (field != MONTH) { return null; } Map<String, Integer> map = new HashMap<>(); if (style == LONG_STANDALONE) { style = LONG; } else if (style == SHORT_STANDALONE) { style = SHORT; } for (int month = JANUARY; month <= DECEMBER; month++) { if (style == ALL_STYLES || style == LONG) { map.put(toMonthName(month + 1, LONG), month); } if (style == ALL_STYLES || style == SHORT) { map.put(toMonthName(month + 1, SHORT), month); } } return map; }
Example 20
Source File: NumberFormatProviderImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public NumberFormat getPercentInstance(Locale locale) { for (int i = 0; i < avail.length; i ++) { if (Utils.supportsLocale(avail[i], locale)) { String pattern = MessageFormat.format(patterns[PERCENTSTYLE], dialect[i]); return new FooNumberFormat(pattern, DecimalFormatSymbols.getInstance(locale)); } } throw new IllegalArgumentException("locale is not supported: "+locale); }