summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-03 12:11:20 -0800
committerZach Copley <zach@status.net>2010-03-03 12:11:20 -0800
commit09169d6f3ce60770d0ae115bde38a9274e794640 (patch)
tree5c680b74ceacacb9dc2c6e3183f150fa45468052
parent82ea0f7884d291f11964d5a54dbf8194ce24cb58 (diff)
parent0881eba80eabfea65919be2f3d65235ccd0b5eb6 (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
* 'testing' of gitorious.org:statusnet/mainline: Language setting fixes:
-rw-r--r--actions/siteadminpanel.php4
-rw-r--r--index.php1
-rw-r--r--lib/default.php3
-rw-r--r--lib/util.php12
4 files changed, 12 insertions, 8 deletions
diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php
index 8c8f8b374..4b29819b7 100644
--- a/actions/siteadminpanel.php
+++ b/actions/siteadminpanel.php
@@ -277,8 +277,8 @@ class SiteAdminPanelForm extends AdminForm
$this->unli();
$this->li();
- $this->out->dropdown('language', _('Language'),
- get_nice_language_list(), _('Default site language'),
+ $this->out->dropdown('language', _('Default language'),
+ get_nice_language_list(), _('Site language when autodetection from browser settings is not available'),
false, $this->value('language'));
$this->unli();
diff --git a/index.php b/index.php
index 06ff9900f..a46bc084d 100644
--- a/index.php
+++ b/index.php
@@ -253,6 +253,7 @@ function main()
$user = common_current_user();
// initialize language env
+common_log(LOG_DEBUG, "XXX: WAIII");
common_init_language();
diff --git a/lib/default.php b/lib/default.php
index 7b50242ae..b7216045c 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -40,7 +40,8 @@ $default =
'logdebug' => false,
'fancy' => false,
'locale_path' => INSTALLDIR.'/locale',
- 'language' => 'en_US',
+ 'language' => 'en',
+ 'langdetect' => true,
'languages' => get_all_languages(),
'email' =>
array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null,
diff --git a/lib/util.php b/lib/util.php
index 46be920fa..da2799d4f 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -105,11 +105,13 @@ function common_language()
// Otherwise, find the best match for the languages requested by the
// user's browser...
- $httplang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null;
- if (!empty($httplang)) {
- $language = client_prefered_language($httplang);
- if ($language)
- return $language;
+ if (common_config('site', 'langdetect')) {
+ $httplang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null;
+ if (!empty($httplang)) {
+ $language = client_prefered_language($httplang);
+ if ($language)
+ return $language;
+ }
}
// Finally, if none of the above worked, use the site's default...