java - ResourceBundle.getBundle(class,locale) don't get default Bundle -


My machine (Windows 7 64 bit) is a very strange behavior with ResourceBundle.getBundle on both Java 7 and Java 8 and I am confused.

.

I try to get the Myraterreser bundle (which spreads the Ressar Bundle) to the selected locale. Here is the general code (Shortline and Simplified):

Default RessourceBundle class:

  Public class MyRessource ResourceBundle Extended {@ Override Object Handgate Object (Last String Key) {if ( Key.equals ("Submit")) Return "Submit"; Return tap;  

German RessourceBundle class:

  public class MyRessource_de MyRessource Extended {@Override Safe Object Handgate Object (Last String Key) {if (key.equals ("Deposit Do ")) Return" Absent "; Return tap; }}  

Then I want to retrieve the German bundle:

  last resource bundle bundle_de = ResourceBundle.getBundle (MyRessource.class.getName () ), Locel Germany); LOG.debug ("bundle {}", bundle_de); LOG.debug (bundle_DE.getString ("Submit"));  

Output is:

Bundle com.example.MyRessource_de@6cf82c7d

Absent

Now with the second language, this default bundle should be returned:

  last resource bundle bundle_an = ResourceBundle.getBundle (MyRessource.class.getName (), locale.uk); LOG.debug ("bundle {}", bundle_en); LOG.debug (bundle_EN.getString ("Submit"));  

But the output is:

Bundle com.example.MyRessource_de@6cf82c7d

Absent

< P> The same cached bundle was returned, I tried to clean the cache with ResourceBundle.clearCache () without any success.

When I apply any other language bundle and ask for it I get it, but I do not get the default-bundle class.

I do not know why Java is behaving this way and will be happy with any answer.

The purpose of the code works on other machines.

BTW: My Windows system language is D.

Resource bundle:

getBundle candidate bundle names Uses the base name, the specified locale, and the default locale (derived from local.gate default) to generate the sequence. If the language, script, country, and variant of the specified locale are all empty strings, then the base name is the name of the only candidate bundle. In other words, because it uses MyResource_UK resource bundle, it uses system base that the candidate uses only the base name before generating the bundle name (and in your case, Succeeds in finding the German bundle).


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -