Path to ResourceBundle / i18n

Hi All Together,

as some of you might already have noticed (from previous questions) I am new to Vaadin. Therefore I have another (very simple question). Its about the paths and ResourceBundles / i18n.

Where is the best place for the .properties files for the ResourceBundle to put in?

Currently I have the files stored in the default package (src/java/messages_en.properties) and I call

ResourceBundle bundle = ResourceBundle.getBundle("messages", Locale.US);

From my understanding it is better to place the .properties files into a sub folder of WEB-INF (i.e. WEB-INF/i18n/messages_en.properties). But I do not know how to call them from there.

The following does not work:

ResourceBundle bundle = ResourceBundle.getBundle("../i18b/messages", Locale.US);

Would be great if someone could tell me what the best place would be to place .properties files and how to call them.

Thanks
Kurt

I’m not sure that I agree that it is better to place the .properties files into WEB-INF; ResourceBundle.getBundle will use the classpath to find the properties files - and WEB-INF/i18n is not on the classpath.

Don’t get me wrong - it is probably possible - but I would suggest it’s best left on the classpath as in your original example, unless there is a concrete reason to do otherwise.

Cheers,

Charles

@Charles,

thanks for your reply and opinion.

No, I do not have a concrete reason. I just wasn’t sure if it is the right way in Vaadin to place the .properties files in the classpath. The themes files have their own directory under the WebContent directory. So I thought .properties files should be placed outside the classpath as well.

Thanks
Kurt