Hi Everyone!
If I'm not wrong there are 3 locales that could play a role:
1. The user's locale, as set for the user in her user information. This
could be, for arguments sake, French.
2. The user's locale, as reported by her browser. This could be, for
example, German, because she is using a PC with a German OS installed.
3. The Content locale, as selected using the editing controls in the
page-bar. This could be, for example, English.
So really, there is a "browser" locale, a user locale and a content locale.
The interaction between these can be quite confusing.
It would be good if someone who knows how it really works could put a table
like the one below in the documentation (this is an example that contains my
assumptions, don't know whether it is right or not?):
Browser Locale
User Locale
Content Locale
${ctx.locale}
${mgnl.aggregationState.locale}
UI displayed as
Content displayed as
X
-
Z
X
Z
X
Z
X
Y
Z
Y
X
Y
Z
X
-
-
X
X
X
X
Regards from Vienna,
Richard
Von: [email protected] [mailto:[email protected]]
Im Auftrag von Grégory Joseph
Gesendet: Montag, 24. Jänner 2011 14:35
An: Magnolia User-List
Betreff: Re: [magnolia-user] How to change the locale in an STK site?!!
On 24 Jan 2011, at 12:09, Will Scheidegger wrote:
We're trying to set the language for the edit bars etc.
- The user's language is set correctly (IMO this is all there should be to it)
That *should* indeed be the case.
Thanks for the feedback. I could resolve the problem by setting the fallback
locale for both content and system to "de". Anyway, I would have expected the
local to be set to whatever you define in the stk site.
Still there is a general problem with the languages, and (IIRC) it has been
discussed on the list before: The user's language might not be the same as the
content's language. But there is only the one i18n object provided by the
freemarker helper class which _should_ be set to the content locale if I'm not
mistaken.
That's indeed the intention. As far as I can see, the locale you get there is
the one passed by the renderer, which is in turn the one given from the
AggregationState.
Have you noticed it wasn't the case ?
What I propose (and what I actually already added to my FreemarkerHelper class
is a second messages wrapper object called "i18nAdmin" which has its locale set
to the users locale (i.e. MgnlContext.getLocale()). This would allow you to use
two separate localization mechanisms in the same template. What do you think?
I think part of the problem is that (some? all?) templates incorrectly use this
i18n object. They shouldn't: iirc, the editbar and other tags already do the
translation job, by (correctly - hopefully!) using the user's language. But
there might be reasons some templates do this (i.e passing parameters to
translated messages, or some of the tags might not behave as expected/wanted).
If you have a minute to look into this, that'd be appreciated. If not, maybe
report it on jira and we'll investigate further.. when time permits.
Adding a second messages wrapper would probably only be half the solution,
since all templates would still need to be updated.
There is another "problem" related to this - the message bundle (i18nBasename)
we use is currently the same for dialogs/editbars than for the "content"
messages (the little messages such as "read on").
WDYT ?
-g
On 24.01.2011, at 10:14, Antti Hietala wrote:
- The user's language is set correctly (IMO this is all there should be to it)
Yes, that should be enough. Are you seeing _any_ translated labels in edit bars
or are just some of them falling back to the default language?
While AdminCentral UI is translated to a high degree, STK is missing
translations for many labels. You are likely to see "Edit Opener", "Edit
Section Header", "New Extras" etc. on the page even if you have set the users
language correctly because these labels have not been translated to your target
language yet. Take a look at the messages_<lang_code>.properties files inside
the STK module.
--Antti
On Jan 23, 2011, at 6:34 PM, Will Scheidegger wrote:
Dear Magnolians
We're trying to set the language for the edit bars etc.
- The user's language is set correctly (IMO this is all there should be to it)
- config:/module/standard-templating-kit/config/site/i18n/locale is also set
accordingly
- the messages file is there
Still, I get the english labels. Any ideas where to look next?!
-will
________________________________
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to:
<[email protected]<mailto:[email protected]>>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------