public function setup() { self::$installed_locales = locales::installed(); self::$default_locale = module::get_var("gallery", "default_locale"); locales::update_installed(array_keys(locales::available())); module::set_var("gallery", "default_locale", "no_NO"); }
public function index($share_translations_form = null) { $v = new Admin_View("admin.html"); $v->content = new View("admin_languages.html"); $v->content->available_locales = locales::available(); $v->content->installed_locales = locales::installed(); $v->content->default_locale = module::get_var("gallery", "default_locale"); if (empty($share_translations_form)) { $share_translations_form = $this->_share_translations_form(); } $v->content->share_translations_form = $share_translations_form; $this->_outgoing_translations_count(); print $v; }
private function _languages_form() { $all_locales = locales::available(); $installed_locales = locales::installed(); $form = new Forge("admin/languages/save", "", "post", array("id" => "gLanguageSettingsForm")); $group = $form->group("choose_language")->label(t("Language settings")); $group->dropdown("locale")->options($installed_locales)->selected(module::get_var("gallery", "default_locale"))->label(t("Default language"))->rules('required'); $installation_options = array(); foreach ($all_locales as $code => $display_name) { $installation_options[$code] = array($display_name, isset($installed_locales->{$code})); } $group->checklist("installed_locales")->label(t("Installed Languages"))->options($installation_options)->rules("required"); $group->submit("save")->value(t("Save settings")); return $form; }