cancel
Showing results for 
Search instead for 
Did you mean: 

I18N with ResourceBundle and WDResourceHandler?!

Former Member
0 Kudos

Hello all,

I'm trying to use internationalization with WebDynpro. I create a properties File, generated the xlf File from it and tried to use the Webdynpro Classes I get an error "MissingresourceException" that the <u>bundle</u> was not found. It is not the key in the bundle, its the bundle itself. My Webdynpro code is like the following:

			
IWDResourceHandler resourceHandler = WDResourceHandler.createResourceHandlerForCurrentSession(); 
resourceHandler.loadResourceBundle("myPath.MyResource");
String myValue = resourceHandler.getString("myKey");

If I use the classic Java way it works:


ResourceBundle myBundle = ResourceBundle.getBundle("myPath.myResource");
String myValue = myBundle.getString("myKey");

Can someone give me a hint whats wrong here? I would like to use that .xlf File as it is (hopefully) visible in the portal for translation.

Thanx for any help,

Frank

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Frank,

Seems like you don`t pass Class to IWDResourceHandler.loadResourceBundle:

http://help.sap.com/saphelp_nw04/helpdata/en/8e/7ce87a2aede645ae3cdc857b791590/content.htm

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hello,

no I <u>can't</u> pass Class to IWDResourceHandler.loadResourceBundle because it expects a <b>ClassLoader</b> instead of a <b>Class</b>. But there is also a method without this parameter that should use the default ClassLoader as I assume. I see no reason to provide a ClassLoader...

This example is (again) not working in my SP9 context.

Best regards,

Frank

former_member182372
Active Contributor
0 Kudos

Hello Frank,

Have you tried to pass this.getClass().getClassLoader() to loadResourceBundle?

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi,

that solved the problem I still don't understand why the ResourceBundle finds the Bundle without giving a ClassLoader, but who cares...

Thanx,

Frank

former_member182372
Active Contributor
0 Kudos

Because loadResourceBundle implementation doesn`t "know" details about caller ClassLoader. And resource file is available only for dynpro component classLoader.

Best regards, Maksim Rashchynski.

Answers (0)