/** * Get the set of locales for which point/vector formats are available. * <p>This is the same set as the {@link NumberFormat} set.</p> * @return available point/vector format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which real vectors formats are available. * <p>This is the same set as the {@link NumberFormat} set.</p> * @return available real vector format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which complex formats are available. This * is the same set as the {@link NumberFormat} set. * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which complex formats are available. * <p>This is the same set as the {@link NumberFormat} set.</p> * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which complex formats are available. This * is the same set as the {@link NumberFormat} set. * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which real vectors formats are available. * <p>This is the same set as the {@link NumberFormat} set.</p> * @return available real vector format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Test the built in choice format. */ @Test public void testBuiltInChoiceFormat() { final Object[] values = new Number[] {Integer.valueOf(1), Double.valueOf("2.2"), Double.valueOf("1234.5")}; String choicePattern = null; final Locale[] availableLocales = NumberFormat.getAvailableLocales(); choicePattern = "{0,choice,1#One|2#Two|3#Many {0,number}}"; for (final Object value : values) { checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales); } choicePattern = "{0,choice,1#''One''|2#\"Two\"|3#''{Many}'' {0,number}}"; for (final Object value : values) { checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales); } }
testLocales.retainAll(Arrays.asList(NumberFormat.getAvailableLocales())); testLocales.add(null);
/** * Test the built in number formats. */ @Test public void testBuiltInNumberFormat() { final Object[] args = new Object[] {Double.valueOf("6543.21")}; final Locale[] availableLocales = NumberFormat.getAvailableLocales(); checkBuiltInFormat("1: {0,number}", args, availableLocales); checkBuiltInFormat("2: {0,number,integer}", args, availableLocales); checkBuiltInFormat("3: {0,number,currency}", args, availableLocales); checkBuiltInFormat("4: {0,number,percent}", args, availableLocales); checkBuiltInFormat("5: {0,number,00000.000}", args, availableLocales); }
/** * Checks if the language is supported. * * @param languageCode language code, e.g. "en", "pt" * @return true if the language is supported */ public static boolean isLanguageSupported(String languageCode) { Locale locale = new Locale(languageCode); Locale[] possibleLocales = NumberFormat.getAvailableLocales(); boolean isLocaleSupported = false; for (Locale possibleLocale : possibleLocales) { // search if local is contained if (possibleLocale.equals(locale)) { isLocaleSupported = true; break; } } return isLocaleSupported; }
/** * Test the built in choice format. */ @Test public void testBuiltInChoiceFormat() { final Object[] values = new Number[] {1, Double.valueOf("2.2"), Double.valueOf("1234.5")}; String choicePattern = null; final Locale[] availableLocales = NumberFormat.getAvailableLocales(); choicePattern = "{0,choice,1#One|2#Two|3#Many {0,number}}"; for (final Object value : values) { checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales); } choicePattern = "{0,choice,1#''One''|2#\"Two\"|3#''{Many}'' {0,number}}"; for (final Object value : values) { checkBuiltInFormat(value + ": " + choicePattern, new Object[] {value}, availableLocales); } }
testLocales.retainAll(Arrays.asList(NumberFormat.getAvailableLocales())); testLocales.add(null);
/** * Get the set of locales for which complex formats are available. This * is the same set as the {@link NumberFormat} set. * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which complex formats are available. This * is the same set as the {@link NumberFormat} set. * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which complex formats are available. * <p>This is the same set as the {@link NumberFormat} set.</p> * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which complex formats are available. This * is the same set as the {@link NumberFormat} set. * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which complex formats are available. This * is the same set as the {@link NumberFormat} set. * @return available complex format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which 3D vectors formats are available. * <p>This is the same set as the {@link NumberFormat} set.</p> * @return available 3D vector format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Get the set of locales for which real vectors formats are available. * <p>This is the same set as the {@link NumberFormat} set.</p> * @return available real vector format locales. */ public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); }
/** * Test the built in number formats. */ @Test public void testBuiltInNumberFormat() { final Object[] args = new Object[] {Double.valueOf("6543.21")}; final Locale[] availableLocales = NumberFormat.getAvailableLocales(); checkBuiltInFormat("1: {0,number}", args, availableLocales); checkBuiltInFormat("2: {0,number,integer}", args, availableLocales); checkBuiltInFormat("3: {0,number,currency}", args, availableLocales); checkBuiltInFormat("4: {0,number,percent}", args, availableLocales); checkBuiltInFormat("5: {0,number,00000.000}", args, availableLocales); }