private static Locale getDefaultLocale() { final String bcp47Tag = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return System.getProperty("org.jboss.logging.locale", ""); } }); if (bcp47Tag.trim().isEmpty()) { return Locale.getDefault(); } // When we upgrade to Java 7 we can use the Locale.forLanguageTag(locale) which will reliably parse the // the value. For now we have to attempt to parse it the best we can. return forLanguageTag(bcp47Tag); }
/** * Get a typed logger which implements the given interface. The current default locale will be used for the new logger. * * @param type the interface to implement * @param category the logger category * @param <T> the logger type * @return the typed logger */ public static <T> T getMessageLogger(Class<T> type, String category) { return getMessageLogger(type, category, LoggingLocale.getLocale()); }
if (count++ == 2 || !isAlpha(parts[index], 3, 3)) { break; if (index != len && isAlpha(parts[index], 4, 4)) { index++; if (index != len && (isAlpha(parts[index], 2, 2) || isNumeric(parts[index], 3, 3))) { region = parts[index++]; if (index != len && (isAlphaOrNumeric(parts[index], 5, 8))) { variant = parts[index];
if (count++ == 2 || !isAlpha(parts[index], 3, 3)) { break; if (index != len && isAlpha(parts[index], 4, 4)) { index++; if (index != len && (isAlpha(parts[index], 2, 2) || isNumeric(parts[index], 3, 3))) { region = parts[index++]; if (index != len && (isAlphaOrNumeric(parts[index], 5, 8))) { variant = parts[index];
/** * Get a message bundle of the given type. Equivalent to <code>{@link #getBundle(Class, java.util.Locale) getBundle}(type, Locale.getDefault())</code>. * * @param type the bundle type class * @param <T> the bundle type * @return the bundle */ public static <T> T getBundle(Class<T> type) { return getBundle(type, LoggingLocale.getLocale()); }
private static Locale getDefaultLocale() { final String bcp47Tag = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return System.getProperty("org.jboss.logging.locale", ""); } }); if (bcp47Tag.trim().isEmpty()) { return Locale.getDefault(); } // When we upgrade to Java 7 we can use the Locale.forLanguageTag(locale) which will reliably parse the // the value. For now we have to attempt to parse it the best we can. return forLanguageTag(bcp47Tag); }
/** * Get a typed logger which implements the given interface. The current default locale will be used for the new logger. * * @param type the interface to implement * @param category the logger category * @param <T> the logger type * @return the typed logger */ public static <T> T getMessageLogger(Class<T> type, String category) { return getMessageLogger(type, category, LoggingLocale.getLocale()); }
/** * Get a message bundle of the given type. Equivalent to <code>{@link #getBundle(Class, java.util.Locale) getBundle}(type, Locale.getDefault())</code>. * * @param type the bundle type class * @param <T> the bundle type * @return the bundle */ public static <T> T getBundle(Class<T> type) { return getBundle(type, LoggingLocale.getLocale()); }