views:

673

answers:

2

How can i change drupal default language programmatically somewhere in code (like template.php)? (i need to overwrite default language set by admin in some cases.) i'm using drupal 6.

PS: please read my own answer for more detail. and if you may help solve that

PS: later i saw a module that was what i wanted. make sure take a look at it:

Administration Language Drupal Module

A: 

The global $language determines the language. So if you change it you'll change the language. But that will be a language switch and not just for a page. It might be possible to switch back and forth. Haven't experimented with it though.

googletorp
A: 

PS at last I did it in template.php like this:

// get the list of availabel languages
$langs = language_list();
// now switch global $language back to 'en'
$vars['language'] = $langs['en'];

it solved some problems but there are still some problems alive. because of i am doing this in theme function, before the code some modules have used drupal defined language and it rises some problems like css directions and so.

If anyone has a better solution to do the code above somewhere perior to template.php i will thank.

takpar