on 04-21-2010 10:42 AM
I am using the following blog to develop a webdynpro application for internationalisation.
I get the following error when I click on the show message button.
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key greetings
I have created a .properties file by typing the code for it in notepad and then saving it as a .properties file.And then I imported the saved file on my desktop in the package explorer. Is this the right way.
Hi Anzar,
Please check if you have added the file under the path Resource->src->packages. Also check in the code if u r providing the path from which the bundle should be taken.
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hahahaha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anzar,
Place your .properties file under src -> packages -> x -> y -> z, where x.y.z is the package name.
So now to initialize the Resource Bundle you should use
ResourceBundle bundle = ResourceBundle.getBundle("x.y.z");
Hope this helps you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Freinds
It is getting the bundle.I checked that .But it is not able to get the resource for the bundle ie. key "farewell"
I have written the MessagesBundle.properties file like this .Is it right?
<dd># MessagesBundle.properties
<dd># <key>=<value>
<dd>greetings = Hello.
<dd>farewell = Goodbye.
<dd>inquiry = How are you?.
and the other one as
<dd># MessagesBundle_en_US.properties
<dd># <key>=<value>
<dd>greetings = Hello.
<dd>farewell = Goodbye.
<dd><inquiry = How are you?.<br>
I think the problem is somewhere here in these files.
My code is as follows:
IWDMessageManager mgr= wdComponentAPI.getMessageManager();
String language;
String country;
Locale currentlocale;
ResourceBundle messages;
currentlocale= new Locale(wdContext.currentContextElement().getLanguageCode(),wdContext.currentContextElement().getCountryCode());
messages=ResourceBundle.getBundle("MessagesBundle",currentlocale);
mgr.reportException(messages.getString("greetings"),false);
mgr.reportException(messages.getString("inquiry"),false);
mgr.reportException(messages.getString("farewell"),false);
Edited by: anzar naik on Apr 22, 2010 6:12 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.