which file name represents a resource bundle file name that is not the default?

Given a language code of fr and a country code of FR, which file name represents a resource
bundle file name that is not the default?

Given a language code of fr and a country code of FR, which file name represents a resource
bundle file name that is not the default?

A.
MessageBundle_fr_FR.properties

B.
MessageBundle_fr_FR.profile

C.
MessageBundle_fr_FR.xinl

D.
MessageBundle__fr__FR.Java

E.
MessageBundle__fr__FR.Locale

Explanation:

The default file is MessageBundle.properties. The non-default file name is
MessageBundle_fr_FR.properties
Note 0:.properties is a file extension for files mainly used in Java related technologies to store the
configurableparameters of an application. They can also be used for storing strings for
Internationalization and localization;these are known as Property Resource Bundles. Each
parameter is stored as a pair of strings, one storing thename of the parameter (called the key),
and the other storing the value.Note 1:You can obtain an instance of ResourceBundle by calling its
static getBundle method.public static ResourceBundle getBundle(java.lang.String baseName)
public static ResourceBundle getBundle(java.lang.String baseName, Locale locale) For example:
ResourceBundle rb = ResourceBundle.getBundle(“MyResources”, Locale.US); This will load
theResourceBundle object with the values in the corresponding properties file.1.If a suitable
properties file is not found, the ResourceBundle object will use the default properties file, whichwill
be the one whose name equals the base name and has the properties extension. In this case, the
defaultfile would be MyResources.properties. 2.If this file is not found, a
java.util.MissingResourceException will bethrown.
Note2:java.util.ResourceBundle class enables you to choose and read the properties file specific
to the user’slocale and look up the values.
A ResourceBundle object has a base name. In order for a ResourceBundle object to pick up a
properties file,the filename must be composed of the ResourceBundle base name, followed by an
underscore, followed bythe language code, and optionally followed by another underscore and the
country code.
The format for the properties file name is as follows:
basename_languageCode_countryCode
For example, suppose the base name is MyResources and you define the following three locales:
US-en
DE-de
CN-zh
Then you would have these three properties files:
MyResources_en_US.properties
MyResources_de_DE.properties
MyResources_zh_CN.properties
Reference:Reading Properties Files using ResourceBundle



Leave a Reply 1

Your email address will not be published. Required fields are marked *