Commit 0881eba8 authored by Brion Vibber's avatar Brion Vibber

Language setting fixes:

- switch 'en_US' to 'en', fixes the "admin panel switches to Arabic" bug
- tweak setting descriptions to clarify that most of the time we'll be using browser language
- add a backend switch to disable language detection (should this be exposed to ui?)
parent c82efb7f
...@@ -277,8 +277,8 @@ class SiteAdminPanelForm extends AdminForm ...@@ -277,8 +277,8 @@ class SiteAdminPanelForm extends AdminForm
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->dropdown('language', _('Language'), $this->out->dropdown('language', _('Default language'),
get_nice_language_list(), _('Default site language'), get_nice_language_list(), _('Site language when autodetection from browser settings is not available'),
false, $this->value('language')); false, $this->value('language'));
$this->unli(); $this->unli();
......
...@@ -253,6 +253,7 @@ function main() ...@@ -253,6 +253,7 @@ function main()
$user = common_current_user(); $user = common_current_user();
// initialize language env // initialize language env
common_log(LOG_DEBUG, "XXX: WAIII");
common_init_language(); common_init_language();
......
...@@ -40,7 +40,8 @@ $default = ...@@ -40,7 +40,8 @@ $default =
'logdebug' => false, 'logdebug' => false,
'fancy' => false, 'fancy' => false,
'locale_path' => INSTALLDIR.'/locale', 'locale_path' => INSTALLDIR.'/locale',
'language' => 'en_US', 'language' => 'en',
'langdetect' => true,
'languages' => get_all_languages(), 'languages' => get_all_languages(),
'email' => 'email' =>
array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null, array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
......
...@@ -105,11 +105,13 @@ function common_language() ...@@ -105,11 +105,13 @@ function common_language()
// Otherwise, find the best match for the languages requested by the // Otherwise, find the best match for the languages requested by the
// user's browser... // user's browser...
$httplang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null; if (common_config('site', 'langdetect')) {
if (!empty($httplang)) { $httplang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null;
$language = client_prefered_language($httplang); if (!empty($httplang)) {
if ($language) $language = client_prefered_language($httplang);
return $language; if ($language)
return $language;
}
} }
// Finally, if none of the above worked, use the site's default... // Finally, if none of the above worked, use the site's default...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment