[opencms-dev] Forcing locale for cms:include fails

Yves Glodt yg at mind.lu
Fri Oct 7 09:24:05 CEST 2011


Hello Tobias,

thanks for the hint, and now I remember you had mentioned this during our
OpenCms training... :-)

Best regards,
Yves

On 7 October 2011 09:21, Tobias Herrmann <t.herrmann at alkacon.com> wrote:

>  Hi Yves,
>
> the parameter '__locale' will only be evauluated once for each request by
> the CmsDefaultLocaleHandler before your template jsp or any other resource
> gets rendered. If you want to set the locale depending on a cookie value,
> you should really implement you own locale handler by implementing
> org.opencms.i18n.I_CmsLocaleHandler or extending
> org.opencms.i18n.CmsDefaultLocaleHandler. You can set the global locale
> handler within /WEB-INF/config/opencms-system.xml at
> opencms/system/internationalization/localehandler.
>
> If you still need to do an include with another locale than the current
> request-context locale, you still could use the OpenCms API by calling
>
> org.opencms.jsp.CmsJspTagInclude.includeTagAction(
>         PageContext context,
>         String target,
>         String element,
>         Locale locale,
>         boolean editable,
>         boolean cacheable,
>         Map<String, String[]> paramMap,
>         Map<String, Object> attrMap,
>         ServletRequest req,
>         ServletResponse res)
>
> This is the same method used by the include tag, only that you can't set
> another locale than the current through the tag.
>
> Greetings,
> Tobias
>
> --
>
> Alkacon Software GmbH - The OpenCms Experts
> http://www.alkacon.com -- http://www.opencms.org
>
>
> Am 05.10.2011 10:29, schrieb Yves Glodt:
>
> Hello,
>
> in my attempt to create a proof-of-concept of a multilanguage-website
> without the needs for /en/, /de/, /fr/ folders and siblings, I tried the
> following in my template:
>
> <cms:include element='body' editable="true">
>     <cms:param name="__locale">${empty cookie.lang.value ? 'en' :
> cookie.lang.value}</cms:param>
> </cms:include>
>
> But it does not work as expected. The __locale parameter seems to be
> ignored. I use OpenCms 7.5.4 here.
>
> Someone else already had this problem:
> http://mail.opencms.org/pipermail/opencms-dev/2008q4/030850.html
>
> Is there a solution in the meantime?
>
> Best regards,
> Yves
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visithttp://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20111007/c68f3473/attachment.htm>


More information about the opencms-dev mailing list