다음을 통해 공유


ResourceBundle.Control.ToBundleName(String, Locale) Method

Definition

Converts the given baseName and locale to the bundle name.

[Android.Runtime.Register("toBundleName", "(Ljava/lang/String;Ljava/util/Locale;)Ljava/lang/String;", "GetToBundleName_Ljava_lang_String_Ljava_util_Locale_Handler")]
public virtual string ToBundleName (string baseName, Java.Util.Locale locale);
[<Android.Runtime.Register("toBundleName", "(Ljava/lang/String;Ljava/util/Locale;)Ljava/lang/String;", "GetToBundleName_Ljava_lang_String_Ljava_util_Locale_Handler")>]
abstract member ToBundleName : string * Java.Util.Locale -> string
override this.ToBundleName : string * Java.Util.Locale -> string

Parameters

baseName
String

the base name of the resource bundle, a fully qualified class name

locale
Locale

the locale for which a resource bundle should be loaded

Returns

the bundle name for the resource bundle

Attributes

Remarks

Converts the given baseName and locale to the bundle name. This method is called from the default implementation of the #newBundle(String, Locale, String, ClassLoader, boolean) newBundle and #needsReload(String, Locale, String, ClassLoader, ResourceBundle, long) needsReload methods.

This implementation returns the following value:

baseName + "_" + language + "_" + script + "_" + country + "_" + variant

where language, script, country, and variant are the language, script, country, and variant values of locale, respectively. Final component values that are empty Strings are omitted along with the preceding '_'. When the script is empty, the script value is omitted along with the preceding '_'. If all of the values are empty strings, then baseName is returned.

For example, if baseName is "baseName" and locale is Locale("ja",&nbsp;"",&nbsp;"XX"), then "baseName_ja_&thinsp;_XX" is returned. If the given locale is Locale("en"), then "baseName_en" is returned.

Overriding this method allows applications to use different conventions in the organization and packaging of localized resources.

Java documentation for java.util.ResourceBundle.Control.toBundleName(java.lang.String, java.util.Locale).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to