示例#1
0
 public function save()
 {
     access::verify_csrf();
     $form = $this->_languages_form();
     if ($form->validate()) {
         module::set_var("gallery", "default_locale", $form->choose_language->locale->value);
         locales::update_installed($form->choose_language->installed_locales->value);
         message::success(t("Settings saved"));
     }
     url::redirect("admin/languages");
 }
示例#2
0
 public function save()
 {
     access::verify_csrf();
     locales::update_installed($this->input->post("installed_locales"));
     $installed_locales = array_keys(locales::installed());
     $new_default_locale = $this->input->post("default_locale");
     if (!in_array($new_default_locale, $installed_locales)) {
         if (!empty($installed_locales)) {
             $new_default_locale = $installed_locales[0];
         } else {
             $new_default_locale = "en_US";
         }
     }
     module::set_var("gallery", "default_locale", $new_default_locale);
     print json_encode(array("result" => "success"));
 }
示例#3
0
 public function locale_from_http_request_prefer_inexact_same_language_match_over_exact_other_language_match_test()
 {
     locales::update_installed(array("de_DE", "ar_AR", "fa_IR", "he_IL", "en_US"));
     // Accept-Language header from Firefox 3.5/Ubuntu
     $_SERVER["HTTP_ACCEPT_LANGUAGE"] = "he,en-us;q=0.9,de-ch;q=0.5,en;q=0.3";
     $locale = locales::locale_from_http_request();
     $this->assert_equal("he_IL", $locale);
 }