/** * Set a text mapping for a single text handle for a given locale. * * @param textID Text handle. Must not be null. Need not be previously defined for this locale. * @param text Localized text for this text handle and locale. Will overwrite any previous mapping, if one existed. * If null, will remove any previous mapping for this text handle, if one existed. * @throws UnregisteredLocaleException If locale is not defined or null. * @throws NullPointerException if textID is null */ public void setLocaleMapping(String textID, String text) { if (textID == null) { throw new NullReferenceException("Null textID when attempting to register " + text + " in locale table"); } if (text == null) { localeData.remove(textID); } else { localeData.put(textID, text); } }
/** * Undefine a locale and remove all its data. Cannot be called on the current locale. If called on the default * locale, no default locale will be set afterward. * * @param locale Locale to remove. Must not be null. Need not be defined. Must not be the current locale. * @return Whether the locale existed in the first place. * @throws IllegalArgumentException If locale is the current locale. * @throws NullPointerException if locale is null */ public Boolean destroyLocale(String locale) { if (locale.Equals(currentLocale)) { throw new ArgumentException("Attempted to destroy the current locale"); } Boolean removed = hasLocale(locale); locales.Remove(locale); localeResources.remove(locale); if (locale.Equals(defaultLocale)) { defaultLocale = null; } return(removed); }