I have a custom module which I want to check the language code of the current interface language, So I added a helper function to the mymodule.module file.
It didn't work in mymodule when I call it, It returned nothing. But If I added this function to my template.php in the mytheme directory it works like a charm and return the language code for the current interface.
I am guesting that its related to the current weight of the module in the system table, What do you think?
function language_code(){
global $language;
return $language->language;
}
For additional debugging I used dpm($language);
after defining global $language;
in mymodule it didn't return the language array.