]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add default language to site admin panel
authorEvan Prodromou <evan@status.net>
Mon, 9 Nov 2009 03:12:12 +0000 (22:12 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 9 Nov 2009 03:12:12 +0000 (22:12 -0500)
actions/siteadminpanel.php

index f66aa855c057efbfa28a3241aa9764231df01a5f..2da26e4bd6db5353f7f56adc47714eb2f3370107 100644 (file)
@@ -90,7 +90,8 @@ class SiteadminpanelAction extends AdminPanelAction
 
     function saveSettings()
     {
-        static $settings = array('name', 'broughtby', 'broughtbyurl', 'email', 'timezone');
+        static $settings = array('name', 'broughtby', 'broughtbyurl',
+                                 'email', 'timezone', 'language');
 
         $values = array();
 
@@ -143,6 +144,12 @@ class SiteadminpanelAction extends AdminPanelAction
             $this->clientError(_('Timezone not selected.'));
             return;
         }
+
+        // Validate language
+
+        if (!is_null($language) && !in_array($language, array_keys(get_nice_language_list()))) {
+            $this->clientError(sprintf(_('Unknown language "%s"'), $language));
+        }
     }
 }
 
@@ -209,6 +216,10 @@ class SiteAdminPanelForm extends Form
         $this->out->dropdown('timezone', _('Default timezone'),
                              $timezones, _('Default timezone for the site; usually UTC.'),
                              true, $this->value('timezone'));
+
+        $this->out->dropdown('language', _('Language'),
+                             get_nice_language_list(), _('Default site language'),
+                             false, $this->value('language'));
     }
 
     /**