This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes languages proplem with IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "languages proplem with IE" Watch "languages proplem with IE" New topic
Author

languages proplem with IE

Lukas Benberg
Ranch Hand

Joined: Jan 03, 2007
Posts: 45
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
Marshal

Joined: Mar 22, 2005
Posts: 41123
    
  45
Applets are independent of anything you're using with JSP/Struts. How is the language selection implemented in the applet?


Ping & DNS - my free Android networking tools app
Lukas Benberg
Ranch Hand

Joined: Jan 03, 2007
Posts: 45
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
Marshal

Joined: Mar 22, 2005
Posts: 41123
    
  45
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

Joined: Jan 03, 2007
Posts: 45
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

Joined: Jan 03, 2007
Posts: 45
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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: languages proplem with IE
 
Similar Threads
FTPClient Applet Problem on HP-UX
any help/tip?
Applets and scripting constraints?
applet to applet communication
appletviewer window never pop up