if (JDKLocaleHelper.hasLocaleCategories()) { Locale currentCategoryDefault = JDKLocaleHelper.getDefault(category); if (!defaultCategoryLocales[idx].equals(currentCategoryDefault)) { defaultCategoryLocales[idx] = currentCategoryDefault;
if (JDKLocaleHelper.isJava7orNewer()) { Locale currentCategoryDefault = JDKLocaleHelper.getDefault(category); if (!defaultCategoryLocales[idx].equals(currentCategoryDefault)) { defaultCategoryLocales[idx] = currentCategoryDefault;
if (JDKLocaleHelper.isJava7orNewer()) { Locale currentCategoryDefault = JDKLocaleHelper.getDefault(category); if (!defaultCategoryLocales[idx].equals(currentCategoryDefault)) { defaultCategoryLocales[idx] = currentCategoryDefault;
defaultULocale = forLocale(currentDefault); if (!JDKLocaleHelper.isJava7orNewer()) {
defaultULocale = forLocale(currentDefault); if (!JDKLocaleHelper.isJava7orNewer()) {
/** * Sets the default <code>ULocale</code> for the specified <code>Category</code>. * This also sets the default <code>Locale</code> for the specified <code>Category</code> * of the JVM. If the caller does not have write permission to the * user.language property, a security exception will be thrown, * and the default ULocale for the specified Category will remain unchanged. * * @param category the specified category to set the default locale * @param newLocale the new default locale * @see SecurityManager#checkPermission(java.security.Permission) * @see java.util.PropertyPermission * @stable ICU 49 */ public static synchronized void setDefault(Category category, ULocale newLocale) { Locale newJavaDefault = newLocale.toLocale(); int idx = category.ordinal(); defaultCategoryULocales[idx] = newLocale; defaultCategoryLocales[idx] = newJavaDefault; JDKLocaleHelper.setDefault(category, newJavaDefault); }
/** * Sets the default <code>ULocale</code> for the specified <code>Category</code>. * This also sets the default <code>Locale</code> for the specified <code>Category</code> * of the JVM. If the caller does not have write permission to the * user.language property, a security exception will be thrown, * and the default ULocale for the specified Category will remain unchanged. * * @param category the specified category to set the default locale * @param newLocale the new default locale * @see SecurityManager#checkPermission(java.security.Permission) * @see java.util.PropertyPermission * @stable ICU 49 */ public static synchronized void setDefault(Category category, ULocale newLocale) { Locale newJavaDefault = newLocale.toLocale(); int idx = category.ordinal(); defaultCategoryULocales[idx] = newLocale; defaultCategoryLocales[idx] = newJavaDefault; JDKLocaleHelper.setDefault(category, newJavaDefault); }
/** * Sets the default <code>ULocale</code> for the specified <code>Category</code>. * This also sets the default <code>Locale</code> for the specified <code>Category</code> * of the JVM. If the caller does not have write permission to the * user.language property, a security exception will be thrown, * and the default ULocale for the specified Category will remain unchanged. * * @param category the specified category to set the default locale * @param newLocale the new default locale * @see SecurityManager#checkPermission(java.security.Permission) * @see java.util.PropertyPermission * @stable ICU 49 */ public static synchronized void setDefault(Category category, ULocale newLocale) { Locale newJavaDefault = newLocale.toLocale(); int idx = category.ordinal(); defaultCategoryULocales[idx] = newLocale; defaultCategoryLocales[idx] = newJavaDefault; JDKLocaleHelper.setDefault(category, newJavaDefault); }
/** * {@icu} Returns a ULocale object for a {@link java.util.Locale}. * The ULocale is canonicalized. * @param loc a JDK locale * @stable ICU 3.2 */ public static ULocale forLocale(Locale loc) { if (loc == null) { return null; } ULocale result = CACHE.get(loc); if (result == null) { result = JDKLocaleHelper.toULocale(loc); CACHE.put(loc, result); } return result; }
/** * {@icu} Returns a ULocale object for a {@link java.util.Locale}. * The ULocale is canonicalized. * @param loc a JDK locale * @stable ICU 3.2 */ public static ULocale forLocale(Locale loc) { if (loc == null) { return null; } ULocale result = CACHE.get(loc); if (result == null) { result = JDKLocaleHelper.toULocale(loc); CACHE.put(loc, result); } return result; }
public static ULocale toULocale(Locale loc) { return hasScriptsAndUnicodeExtensions ? toULocale7(loc) : toULocale6(loc); }
public static ULocale toULocale(Locale loc) { return isJava7orNewer ? toULocale7(loc) : toULocale6(loc); }
public static ULocale toULocale(Locale loc) { return isJava7orNewer ? toULocale7(loc) : toULocale6(loc); }
@Override protected ULocale createInstance(Locale key, Void unused) { return JDKLocaleHelper.toULocale(key); } };
/** * {@icu} Converts this ULocale object to a {@link java.util.Locale}. * @return a {@link java.util.Locale} that either exactly represents this object * or is the closest approximation. * @stable ICU 2.8 */ public Locale toLocale() { if (locale == null) { locale = JDKLocaleHelper.toLocale(this); } return locale; }
/** * {@icu} Converts this ULocale object to a {@link java.util.Locale}. * @return a JDK locale that either exactly represents this object * or is the closest approximation. * @stable ICU 2.8 */ public Locale toLocale() { if (locale == null) { locale = JDKLocaleHelper.toLocale(this); } return locale; }
/** * {@icu} Converts this ULocale object to a {@link java.util.Locale}. * @return a JDK locale that either exactly represents this object * or is the closest approximation. * @stable ICU 2.8 */ public Locale toLocale() { if (locale == null) { locale = JDKLocaleHelper.toLocale(this); } return locale; }