Get current language

3 messages Options
Embed this post
Permalink
spunkjazz () Get current language
Reply Threaded More More options
Print post
Permalink
Hi,

in my Plone-site I switch languages by adding
'?set_language=LANGUAGE-CODE' to the url. This works fine but if I want
to get the current language with plone_portal_state.language() it always
returns the default language also it's supposed to return the current
language.

I'm running Plone 3.2.2 and LinguaPlone 2.4. Is it a bug or am I missing
something?

While playing around with language settings I found out that it is
possible to get the current language with
portal_languages.getLanguageBindings(). It's the first element of the
returned list. Are there any differences in getting the current language
between plone_portal_state.language() and
portal_languages.getLanguageBindings() besides former method doesn't
seem to work properly?

Best regards
Tobias



------------------------------------------------------------------------------
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
robert rottermann () Re: Get current language
Reply Threaded More More options
Print post
Permalink
I can not check this now, but I believe it iy called getPreferedLanguage or some
such
robert

Tobias Schmidt schrieb:

> Hi,
>
> in my Plone-site I switch languages by adding
> '?set_language=LANGUAGE-CODE' to the url. This works fine but if I want
> to get the current language with plone_portal_state.language() it always
> returns the default language also it's supposed to return the current
> language.
>
> I'm running Plone 3.2.2 and LinguaPlone 2.4. Is it a bug or am I missing
> something?
>
> While playing around with language settings I found out that it is
> possible to get the current language with
> portal_languages.getLanguageBindings(). It's the first element of the
> returned list. Are there any differences in getting the current language
> between plone_portal_state.language() and
> portal_languages.getLanguageBindings() besides former method doesn't
> seem to work properly?
>
> Best regards
> Tobias
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>
>


------------------------------------------------------------------------------
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
spunkjazz () Re: Get current language
Reply Threaded More More options
Print post
Permalink
Thank you, Robert, you're right: portal_languages.getPreferredLanguage()
gives you the current language which seems to be the same as the first
element of the returned tuple of portal_languages.getLanguageBindings().
What about plone_portal_state.language()?

robert rottermann schrieb:

> I can not check this now, but I believe it iy called getPreferedLanguage or some
> such
> robert
>
> Tobias Schmidt schrieb:
>> Hi,
>>
>> in my Plone-site I switch languages by adding
>> '?set_language=LANGUAGE-CODE' to the url. This works fine but if I want
>> to get the current language with plone_portal_state.language() it always
>> returns the default language also it's supposed to return the current
>> language.
>>
>> I'm running Plone 3.2.2 and LinguaPlone 2.4. Is it a bug or am I missing
>> something?
>>
>> While playing around with language settings I found out that it is
>> possible to get the current language with
>> portal_languages.getLanguageBindings(). It's the first element of the
>> returned list. Are there any differences in getting the current language
>> between plone_portal_state.language() and
>> portal_languages.getLanguageBindings() besides former method doesn't
>> seem to work properly?
>>
>> Best regards
>> Tobias

------------------------------------------------------------------------------
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users