summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/admin_languages.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers/admin_languages.php')
-rw-r--r--modules/gallery/controllers/admin_languages.php39
1 files changed, 21 insertions, 18 deletions
diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php
index d91e5205..27537c7f 100644
--- a/modules/gallery/controllers/admin_languages.php
+++ b/modules/gallery/controllers/admin_languages.php
@@ -24,7 +24,7 @@ class Admin_Languages_Controller extends Admin_Controller {
$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();
}
@@ -35,21 +35,21 @@ class Admin_Languages_Controller extends Admin_Controller {
public function save() {
access::verify_csrf();
-
- locales::update_installed($this->input->post("installed_locales"));
-
- $installed_locales = array_keys(locales::installed());
+
+ 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"));
+ 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"));
}
public function share() {
@@ -88,6 +88,8 @@ class Admin_Languages_Controller extends Admin_Controller {
message::success(t("Your API key has been changed."));
} else if (!$old_key && $new_key) {
message::success(t("Your API key has been saved."));
+ } else if ($old_key && $new_key && $old_key == $new_key) {
+ message::info(t("Your API key was not changed."));
}
log::success(t("gallery"), t("l10n_client API key changed."));
@@ -103,16 +105,17 @@ class Admin_Languages_Controller extends Admin_Controller {
}
private function _share_translations_form() {
- $form = new Forge("admin/languages/share", "", "post", array("id" => "gShareTranslationsForm"));
+ $form = new Forge("admin/languages/share", "", "post", array("id" => "g-share-translations-form"));
$group = $form->group("sharing")
->label(t("Sharing your own translations with the Gallery community is easy. Please do!"));
$api_key = l10n_client::api_key();
$server_link = l10n_client::server_api_key_url();
$group->input("api_key")
->label(empty($api_key)
- ? t("This is a unique key that will allow you to send translations to the remote server. To get your API key go to %server-link.",
+ ? t("This is a unique key that will allow you to send translations to the remote
+ server. To get your API key go to %server-link.",
array("server-link" => html::mark_clean(html::anchor($server_link))))
- : t("API Key"))
+ : t("API key"))
->value($api_key)
->error_messages("invalid", t("The API key you provided is invalid."));
$group->submit("save")->value(t("Save settings"));