/** * {@icu} Sets the default ULocale. This also sets the default Locale. * If the caller does not have write permission to the * user.language property, a security exception will be thrown, * and the default ULocale will remain unchanged. * <p> * By setting the default ULocale with this method, all of the default categoy locales * are also set to the specified default ULocale. * @param newLocale the new default locale * @throws SecurityException if a security manager exists and its * <code>checkPermission</code> method doesn't allow the operation. * @throws NullPointerException if <code>newLocale</code> is null * @see SecurityManager#checkPermission(java.security.Permission) * @see java.util.PropertyPermission * @see ULocale#setDefault(Category, ULocale) * @stable ICU 3.0 */ public static synchronized void setDefault(ULocale newLocale){ defaultLocale = newLocale.toLocale(); Locale.setDefault(defaultLocale); defaultULocale = newLocale; // This method also updates all category default locales for (Category cat : Category.values()) { setDefault(cat, newLocale); } }
/** * {@icu} Sets the default ULocale. This also sets the default Locale. * If the caller does not have write permission to the * user.language property, a security exception will be thrown, * and the default ULocale will remain unchanged. * <p> * By setting the default ULocale with this method, all of the default categoy locales * are also set to the specified default ULocale. * @param newLocale the new default locale * @throws SecurityException if a security manager exists and its * <code>checkPermission</code> method doesn't allow the operation. * @throws NullPointerException if <code>newLocale</code> is null * @see SecurityManager#checkPermission(java.security.Permission) * @see java.util.PropertyPermission * @see ULocale#setDefault(Category, ULocale) * @stable ICU 3.0 */ public static synchronized void setDefault(ULocale newLocale){ defaultLocale = newLocale.toLocale(); Locale.setDefault(defaultLocale); defaultULocale = newLocale; // This method also updates all category default locales for (Category cat : Category.values()) { setDefault(cat, newLocale); } }
/** * Sets the default ULocale. This also sets the default Locale. * If the caller does not have write permission to the * user.language property, a security exception will be thrown, * and the default ULocale will remain unchanged. * <p> * By setting the default ULocale with this method, all of the default categoy locales * are also set to the specified default ULocale. * @param newLocale the new default locale * @throws SecurityException if a security manager exists and its * <code>checkPermission</code> method doesn't allow the operation. * @throws NullPointerException if <code>newLocale</code> is null * @see SecurityManager#checkPermission(java.security.Permission) * @see java.util.PropertyPermission * @see ULocale#setDefault(Category, ULocale) * @stable ICU 3.0 */ public static synchronized void setDefault(ULocale newLocale){ defaultLocale = newLocale.toLocale(); Locale.setDefault(defaultLocale); defaultULocale = newLocale; // This method also updates all category default locales for (Category cat : Category.values()) { setDefault(cat, newLocale); } }
/** * 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); }