java.util.Locale.Category Java Examples
The following examples show how to use
java.util.Locale.Category.
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: FormatLocale.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static void formatLocaleTest() { StringBuilder sb = new StringBuilder(); IntStream.range(0, src.size()).forEach(i -> { sb.setLength(0); Locale.setDefault(Locale.Category.FORMAT, formatLocale.get(i)); new Formatter(sb).format(conversions.get(i), src.get(i)); if (!sb.toString().equals(expected.get(i))) { throw new RuntimeException( "Wrong uppercasing with Formatter.format(" + "\"" + conversions.get(i) + "\"" + ") in locale " + formatLocale.get(i) + ". Expected: " + expected.get(i) + " Returned: " + sb.toString()); } }); }
Example #2
Source File: LauncherHelper.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #3
Source File: LauncherHelper.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #4
Source File: LauncherHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #5
Source File: LauncherHelper.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #6
Source File: LauncherHelper.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #7
Source File: LauncherHelper.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #8
Source File: LauncherHelper.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #9
Source File: LauncherHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #10
Source File: FormatLocale.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) { IntStream.range(0, formatLocale.size()).forEach(i -> { Locale.setDefault(Locale.Category.FORMAT, formatLocale.get(i)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); new PrintStream(baos).format("%.2f", src); if (!baos.toString().equals(expected.get(i))) { throw new RuntimeException( "Wrong conversion with PrintStream.format() in locale " + formatLocale.get(i) + ". Expected: " + expected.get(i) + " Returned: " + baos.toString()); } }); }
Example #11
Source File: LauncherHelper.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #12
Source File: LauncherHelper.java From Bytecoder with Apache License 2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayName()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #13
Source File: LauncherHelper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #14
Source File: LauncherHelper.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #15
Source File: LauncherHelper.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #16
Source File: LauncherHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void printLocale() { Locale locale = Locale.getDefault(); ostream.println(LOCALE_SETTINGS); ostream.println(INDENT + "default locale = " + locale.getDisplayLanguage()); ostream.println(INDENT + "default display locale = " + Locale.getDefault(Category.DISPLAY).getDisplayName()); ostream.println(INDENT + "default format locale = " + Locale.getDefault(Category.FORMAT).getDisplayName()); printLocales(); ostream.println(); }
Example #17
Source File: OsgiMessageInterpolator.java From packagedrone with Eclipse Public License 1.0 | 4 votes |
@Override public String interpolate ( final String message, final Context context ) { return interpolate ( message, context, Locale.getDefault ( Category.DISPLAY ) ); }
Example #18
Source File: MainDoubleToString.java From ph-commons with Apache License 2.0 | 4 votes |
@SuppressFBWarnings ("UC_USELESS_OBJECT") private static void _main_adj (final int repeat, final String name, final double [] arr) { long time1; final MainDoubleToString a = new MainDoubleToString (); LOGGER.info ("The " + name); LOGGER.info (" " + Arrays.toString (arr)); LOGGER.info ("are appended to a StringBuilder one by one " + repeat + " times."); Runtime.getRuntime ().gc (); LOGGER.info ("Starting test"); time1 = System.currentTimeMillis (); StringBuilder s1 = new StringBuilder (); for (int i = repeat; i > 0; i--) for (int j = arr.length - 1; j >= 0; j--) a.append (s1, arr[j]); time1 = System.currentTimeMillis () - time1; LOGGER.info (" The append took " + time1 + " milliseconds"); s1 = null; Runtime.getRuntime ().gc (); LOGGER.info ("Starting test"); time1 = System.currentTimeMillis (); StringBuilder s2 = new StringBuilder (); for (int i = repeat; i > 0; i--) for (int j = arr.length - 1; j >= 0; j--) a.appendFormatted (s2, arr[j], 4, ',', '.', 3, '-', NO_PREFIX_OR_SUFFIX); time1 = System.currentTimeMillis () - time1; LOGGER.info (" The format append took " + time1 + " milliseconds"); s2 = null; Runtime.getRuntime ().gc (); LOGGER.info ("Starting test"); StringBuilder s3 = new StringBuilder (); time1 = System.currentTimeMillis (); for (int i = repeat; i > 0; i--) for (int j = arr.length - 1; j >= 0; j--) s3.append (arr[j]); time1 = System.currentTimeMillis () - time1; LOGGER.info (" The StringBuilder took " + time1 + " milliseconds"); s3 = null; Runtime.getRuntime ().gc (); StringBuffer sb1 = new StringBuffer (); LOGGER.info ("Starting test"); time1 = System.currentTimeMillis (); final DecimalFormat format = new DecimalFormat ("#,##0.0000", DecimalFormatSymbols.getInstance (Locale.getDefault (Category.FORMAT))); final FieldPosition f = new FieldPosition (0); for (int i = repeat; i > 0; i--) for (int j = arr.length - 1; j >= 0; j--) format.format (arr[j], sb1, f); time1 = System.currentTimeMillis () - time1; LOGGER.info (" The DecimalFormat took " + time1 + " milliseconds"); sb1 = null; Runtime.getRuntime ().gc (); s1 = new StringBuilder (); for (int j = arr.length - 1; j >= 0; j--) { if (s1.length () > 0) s1.append (", "); a.append (s1, arr[j]); } s2 = new StringBuilder (); for (int j = arr.length - 1; j >= 0; j--) { if (s2.length () > 0) s2.append (", "); a.appendFormatted (s2, arr[j], 4, ',', '.', 3, '-', NO_PREFIX_OR_SUFFIX); } s3 = new StringBuilder (); time1 = System.currentTimeMillis (); for (int j = arr.length - 1; j >= 0; j--) { if (s3.length () > 0) s3.append (", "); s3.append (arr[j]); } sb1 = new StringBuffer (); for (int j = arr.length - 1; j >= 0; j--) { if (sb1.length () > 0) sb1.append (", "); format.format (arr[j], sb1, f); } LOGGER.info (" " + s1); LOGGER.info (" " + s2); LOGGER.info (" " + s3); LOGGER.info (" " + sb1); LOGGER.info (""); }