[opencms-dev] multi-language pages in 5.3.4

Martin Kuba makub at ics.muni.cz
Thu May 13 11:04:01 CEST 2004


Alexander Kandzior wrote:
> Yes, it will require programming a locale handler that does this, but this
> is pretty easy. The configured handler is set in opencms-system.xml:
> 
> <localehandler class="org.opencms.i18n.CmsDefaultLocaleHandler"/>
> 
> Have a look at the source code of this class, it just searches the "locale"
> property. Writing your own version that uses the Accept-Language header
> would be easy, since we even have a class 
> 
> org.opencms.i18n.CmsAcceptLanguageHeaderParser 
> 
> already available (which is used by the workplace). Check the code of 
> 
> org.oepncms.workplace.CmsWorkplaceManager 
> 
> which also implements a locale handler for the Workplace and look at the
> method 
> 
> public CmsI18nInfo getI18nInfo(...) 
> 
> which already uses the Accept-Language header as fallback if the user logs
> in for the first time. From there creating a locale handler should be pretty
> straightforward.

Thanks a lot, I will try it. Though I have a question - why
is the class CmsAcceptLanguageHeaderParser parsing the header, the
javax.servlet.ServletRequest.getLocales() seems
to be already doing the same thing, see
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRequest.html#getLocales()

Martin
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno             Martin Kuba
Institute of Computer Science    email: makub at ics.muni.cz
Masaryk University             http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3415 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040513/cf084b9b/attachment.bin>


More information about the opencms-dev mailing list