Hello,

My doubt is about coding and my i18n works fine.
How can i set the site's language trougth a flex button?
I know i can retrive it trougth i18n_get_lang(), but i can't see how to make a set method.
I saw i18n_variable_init() but i'm not sure about it.

my case:
My site is all in flex and it is multilingual. I have buttons in flex that change the language but i don't how to pass a call to i18n to change the language of the session. Because this, i get two problemns:

1 - my search trougth flex only returns nodes from the default language, meanwhile my search trougth html version of site returns results of the language i switched.

2 - my feed only appears with default language. in flex there is a call to rss.xml, this "page" handled by drupal checks global $language. But i don't know to edit trougth a flex a call.

So i'd like to be able to set my global $language...so........how do i do it?

$language = "fr" where?? and how to make a call?

Please, if you have some ideia tell me :)

PS: the flex part is ok for me. my doubts are about php/drupal functions to set global $language.

Comments

jose reyero’s picture

Status: Active » Fixed

There's a global $language (object) variable, read Drupal core code for a good reference.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

j0hn-smith’s picture

Here is a function to change the current language (defaults to English).

function set_language($lang = 'en'){

  $languages = language_list(); // get all languages

  global $language;
  $language = $languages[$lang];

}