Re: can't get setting locale to work
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Friday, August 22, 2008, 9:57:55 PM, Anna Putnam wrote:
> I am having trouble using
> <#setting locale="es_ES"/>
>
> I have this in my ftl code:
>
> <h1>${locale}</h1>
> <#setting locale="es_ES"/>
> <h1>${locale}</h1>
>
> And always my page has:
>
> <h1>en_US</h1>
> <h1>en_US</h1>
>
> Is there other configuration that I need to make this work?
When you write ${locale}, you print the *plain* variable (most
certainly a data-model variable) called "locale". That you could set
as <#assign locale = "es_ES">, but as it is just a plain variable it
wouldn't have any special meaning for FreeMarker. Now, when you write
write <#setting locale="es_ES"> (as opposed to #assign) then you set the
FreeMasker *setting* called "locale". For reading the value of that
setting you can use the *special* variable called "locale", and for
referring to special variable you use an initial dot, like this:
${.locale}
> I am using freemarker version 2.3.8
>
> Thank you in advance.
>
> -Anna
>
>
--
Best regards,
Daniel Dekany
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/