Page 1 of 1

[answered] about cms_set_language in combination with news

Posted: Sun Jun 24, 2012 1:17 pm
by deactivated010521
Rev: 8101

Currently I am testing the new cms_lang tags. They seem to work pretty well, nice addition.

I have set the default front-end language to en_US later I set the language to nl_NL. {$nls->key()} is printing the right values.

Code: Select all

{cms_lang_info assign='nls'}
key: {$nls->key()} <br>
fullname: {$nls->fullname()} <br>

<!-- cms_set_language -->
{cms_set_language lang="nl_NL"}
<!-- /cms_set_language -->

{cms_lang_info assign='nls'}
key: {$nls->key()} <br>
fullname: {$nls->fullname()} <br>

<b>Give me the nl_NL news version</b>
{news action=fesubmit}

Code: Select all

key: en_US
fullname: English
key: nl_NL
fullname: Dutch 
By using {cms_set_language lang="nl_NL"} at last I suppose I am in 'Dutch' mode but when I call the news tag I get the 'en_US' translations.

How can I get the 'Dutch' translation by using the news tag. Since (optional) lang="..." is deprecated.

Changing the front-end language is obvious but for mulilang sites there can be multiple front-end languages.

Re: Question about cms_set_language in combination with news

Posted: Sun Jun 24, 2012 2:24 pm
by calguy1000
The NLS/lang stuff will not support changing the language (and therefore the NLS codes and everything else) multiple times in the same page.

One call per request.

Re: Question about cms_set_language in combination with news

Posted: Sun Jun 24, 2012 2:29 pm
by deactivated010521
Ok thank you for the feedback. Setting the default frontend language to en_US and switching once works great.

Code: Select all

<!-- cms_set_language -->
{cms_set_language lang="nl_NL"}
<!-- /cms_set_language -->

{cms_lang_info assign='nls'}
key: {$nls->key()} <br>
fullname: {$nls->fullname()} <br>

<b>Give me the nl_NL news version</b>
{news action=fesubmit}