function og_set_locale in Organic groups 5.2
Same name and namespace in other branches
- 5.8 og.module \og_set_locale()
- 5 og.module \og_set_locale()
- 5.3 og.module \og_set_locale()
- 5.7 og.module \og_set_locale()
Like locale_initialize(), but includes a check for group language and sets accordingly. Priority goes: user => group => site default
1 call to og_set_locale()
File
- ./
og.module, line 165
Code
function og_set_locale() {
global $user, $locale;
if (function_exists('locale')) {
$languages = locale_supported_languages();
$languages = $languages['name'];
}
else {
// Ensure the locale/language is correctly returned, even without locale.module.
// Useful for e.g. XML/HTML 'lang' attributes.
$languages = array(
'en' => 'English',
);
}
if ($user->uid && isset($languages[$user->language])) {
// do nothing. user specified language has priority
}
elseif ($group_node = og_get_group_context()) {
if ($group_node->og_language && isset($languages[$group_node->og_language])) {
$locale = $group_node->og_language;
}
}
}