> -----Original Message----- > From: Michael Burschik [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 22, 2003 10:16 AM > To: [EMAIL PROTECTED] > Subject: How to determine language in a portlet? > > > I am using Jetspeed's localization feature successfully in > velocity templates. However, I would like a portlet to return > dates formatted according to the conventions of the user's locale. > JetspeedLink.getLanguage() returns null, which seems to be > explained by the documentation, as the PSML document involved > is not localized. > Rundata.GetLocale() returns "en_US", which seems to be the > default locale, although the template is correctly localized > in German. How can I determine the requested locale? >
I don't know if Jetspeed provides any methods for that, but you can get it from the request (which is also used by Jetspeed to decide the localization): runData.getRequest().getLocale() >From the javadoc: Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server. HTH, Holger --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
