Locating locale specifiv resources

S

Simon

Hi,

ResourceBundle#getBundle() [1] has a very nice strategy to lookup files
based on a locale. Is there a way to get similar functionality that just
returns a list of resources, e.g. as URLs, but leaves the loading and
the chaining to the parents to the caller?

In my case, these are XML localized documentation files, but I can
imagine that this is also useful for other applications like localized
Icons, etc.

Cheers,
Simon


[1]
http://java.sun.com/javase/6/docs/a...ing, java.util.Locale, java.lang.ClassLoader)
 
J

John B. Matthews

Simon said:
ResourceBundle#getBundle() [1] has a very nice strategy to lookup
files based on a locale. Is there a way to get similar functionality
that just returns a list of resources, e.g. as URLs, but leaves the
loading and the chaining to the parents to the caller?

In my case, these are XML localized documentation files, but I can
imagine that this is also useful for other applications like
localized Icons, etc.

[1]<http://java.sun.com/javase/6/docs/api/java/util/ResourceBundle.html>

Would extending ResourceBundle.Control [2] be of use in this? I see it
has an XML example:

[2]<http://java.sun.com/javase/6/docs/api/java/util/
ResourceBundle.Control.html>
 
S

Simon

Would extending ResourceBundle.Control [2] be of use in this?

Yes, that's perfect. I didn't know the class, although it is documented
very prominently in ResourceBundle. I must have missed it when 1.6 was
released.

Thanks a lot!

Cheers,
Simon
 
R

Roedy Green

ResourceBundle#getBundle() [1] has a very nice strategy to lookup files
based on a locale. Is there a way to get similar functionality that just
returns a list of resources, e.g. as URLs, but leaves the loading and
the chaining to the parents to the caller?

In my case, these are XML localized documentation files, but I can
imagine that this is also useful for other applications like localized
Icons, etc.

A way to solve this problem if you can't do it with the docs is to
look in src.zip for the source code of getBundle. You can then see if
they have neatly partitioned the find and load logic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top