• Post Reply Bookmark Topic Watch Topic
  • New Topic

Localization  RSS feed

 
Marco Alessandri
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm quite new to the Java world and I don't know how to proceed. What I need, for a start, is a simple guide on how to create a class that extends ResourceBundle and basically does the same of the original one (setting the bundle and retrieve a string with the key). Any idea where I can find it?
 
Stephan van Hulst
Saloon Keeper
Posts: 7969
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marco, welcome to CodeRanch!

Have you taken a look at the documentation for ListResourceBundle and PropertyResourceBundle? The latter especially is a good class to help you on your way.
 
Marco Alessandri
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I've seen your links but I don't think they could help me. What I need is a MyResourceBundle class that extends ResourceBundle with a help on how to implement the required methods (getKeys() and handleGetObject(String key)) in order to make it do exactly the same of the original class. In this way when I call the MyResourceBundle resource MyResourceBundle.getBundle(filepath, locale).getString(key) the results should be the same of the ResourceBundle class.
 
Stephan van Hulst
Saloon Keeper
Posts: 7969
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need a MyResourceBundle? What is it going to do differently than say, a PropertyResourceBundle with a properties file?
 
Marco Alessandri
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Later on that MyResourceBundle will implement an Interface with the same methods of another class that extends the I18N through Struts. From the Java side what I need to achieve is something like "MyResourceBundle.getBundle(filepath, locale).getString(key)". Any help?
 
Marco Alessandri
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any suggestion?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you follow what Stephan suggested? ResourceBundles
 
Marco Alessandri
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works fine using ResourceBundle class but what I need is my custom subclass of it. In your link, under "Other Resource Bundles", they tell me that is possible to do it but not how to do it
 
Marco Alessandri
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example here:

http://www.webreference.com/programming/Globalize-Web-Applications14_Java_Text/2.html

Under "Creating Your Own ResourceBundle" there's a simple example but it doesn't tell me how to call that bundle or how can I implement the property file version.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!