Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

languages proplem with IE

 
Lukas Benberg
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have some jsp/Struts websites that are displayed in different languages (according to the browser settings) using ApplicationResources.properties files. This works fine. But also an Applet is included and the language selection in the Applet does not work with Internet Explorer (in Firefox and Netscape it works). Can someone give me a hint what the problem could be?

Thanks, L
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets are independent of anything you're using with JSP/Struts. How is the language selection implemented in the applet?
 
Lukas Benberg
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,
the i18n in the applet works like this in my case:

1. send Locale as parameter for applet embedding applet tag:
<param name="language" value="<%=session.getAttribute("org.apache.struts.action.LOCALE")%>" />

2. create ResourceBundle from path and given Locale:
ResourceBundle res_bundle = ResourceBundle.getBundle(path_to_bundle, currentLocale);

4. read a String from the ApplicationResources file: String message = res_bundle.getString("message");
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So where in the applet is the problem:

- transferring the correct locale to the applet,

- selecting the proper resource bundle,

- or getting the correct value from the bundle?
 
Lukas Benberg
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,
ok, I think the problem is that the Locale is not set correctly in InternetExplorer. Here is the relevant code:



Output in Firefox 2:
DisplayLanguage: Italienisch
Locale in ResourceBundle: it //correct
DisplayLanguage in ResourceBundle: Italienisch


Output in InternetExplorer 7:
DisplayLanguage: it_it //different from the Firefox output
Locale in ResourceBundle: de //incorrect, this is the default Locale
DisplayLanguage in ResourceBundle: Deutsch


But I have no idea why it gets wrong here...
 
Lukas Benberg
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got another hint: a user told me that it does work correctly with IE6. However I cannot test this, since I don't have IE6...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic