aspose file tools*
The moose likes Java in General and the fly likes Resource bundle without country? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Resource bundle without country?" Watch "Resource bundle without country?" New topic
Author

Resource bundle without country?

David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
Is it possible to use a file named wiht only the language?
EXAMPLE:
Resource_es.properties
I would hope this would cover all Spanish languages, regardless of country.
The issue we're having is replicating all of the "es" translated files to the multiple countries we'd like to support.
My question is thus:
If we leave off the Country from the filename, does it still get picked up, if the user's language is Spanish, using the syntax above?
girish rateshwar
Ranch Hand

Joined: Mar 04, 2001
Posts: 99
hi,
Well below is wat i found in the java docs.

Appending the locale name to the base name of the bundle effectively links the bundle's usage to a specific locale. When you ask for the bundle using ResourcBundle.getBundle("MyResource"), the getBundle method appends the default locale identifier to the base name and loads the appropriate bundle.
The getBundle method provides a graceful degradation algorithm that attempts to find the nearest matched bundle in cases where the specified bundle can't be found or doesn't exist.

In the following search, each element of the search name is separated with an '_' (UNDERSCORE) character. The algorithm searches for bundle names in the following order:
<baseclass>+<specific language>+
<specific country>+<specific variant>
<baseclass>+<specific language>+
<specific country>
<baseclass>+<specific language>
<baseclass>+<default language>+
<default country>+<default variant>
<baseclass>+<default language>+
<default country>
<baseclass>+<default language>
<baseclass>
If no bundle is found, getBundle throws a MissingResourceException.
Regards,


Girish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Resource bundle without country?