summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-22 08:53:50 -0800
committerEvan Prodromou <evan@status.net>2009-12-22 08:53:50 -0800
commita2cb0a033fa6777d824dc40e759294287bd83939 (patch)
tree96b6947fd9aa7a76c1888a127e21e34319334f9b /lib/util.php
parentf17016470170401e1ad1b869c740063a578cb4cd (diff)
parentc9c316db7f003e018202e6c9f39770c208aecc05 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/util.php b/lib/util.php
index af4885f40..ed81aeba1 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -91,8 +91,16 @@ function common_language()
if (_have_config() && common_logged_in()) {
$user = common_current_user();
$user_language = $user->language;
- if ($user_language)
- return $user_language;
+
+ if ($user->language) {
+ // Validate -- we don't want to end up with a bogus code
+ // left over from some old junk.
+ foreach (common_config('site', 'languages') as $code => $info) {
+ if ($info['lang'] == $user_language) {
+ return $user_language;
+ }
+ }
+ }
}
// Otherwise, find the best match for the languages requested by the