• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

ResourceBundle not using Locale

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure what I'm doing wrong - this seems very straightforward. I have simple internationalization code and I'm trying to override the Locale being used. However, using the PropertyResourceBundle.getBundle(String, Locale), the Locale seems to be ignored.

Here's the test class:


Here's the TextLabel class:


Pretty straightforward. However, the output generated is:
Locale = en_US
Bundle using
Locale = en_US
Bundle using
Locale = en_US
Bundle using fr_CA

I would expect the last one to say "Bundle using en_US". I'm running the test inside Eclipse 3.3.0 using Sun's 1.5.0.13 JVM. Any ideas why the Locale is being ignored?

Thanks in advance!
 
todd runstein
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved it. I had 2 properties files: Text_Labels.properties and Text_Labels_fr_CA.properties. Simply adding a file named Text_Labels_en.properties (which matches Text_Labels.properties) fixes the problem!
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just so that everyone gets the idea, let's slide this (probably already finished) thread over to the intermediae forum.
 
The only thing that kept the leeches off of me was this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic