]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - index.php
Add language selection in the configure page of the default theme
[github/shaarli/Shaarli.git] / index.php
index 98171d786a75e3a03db57d6e024523f1fe94dec9..1dc81843f2c8ed09b55fd2904bdec24ec75727b8 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1170,6 +1170,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
             $conf->set('privacy.hide_public_links', !empty($_POST['hidePublicLinks']));
             $conf->set('api.enabled', !empty($_POST['enableApi']));
             $conf->set('api.secret', escape($_POST['apiSecret']));
+            $conf->set('translation.language', escape($_POST['language']));
+
             try {
                 $conf->write(isLoggedIn());
                 $history->updateSettings();
@@ -1207,6 +1209,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
             $PAGE->assign('hide_public_links', $conf->get('privacy.hide_public_links', false));
             $PAGE->assign('api_enabled', $conf->get('api.enabled', true));
             $PAGE->assign('api_secret', $conf->get('api.secret'));
+            $PAGE->assign('languages', Languages::getAvailableLanguages());
+            $PAGE->assign('language', $conf->get('translation.language'));
             $PAGE->renderPage('configure');
             exit;
         }
@@ -1232,9 +1236,10 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
         }
         $delete = empty($_POST['totag']);
         $redirect = $delete ? 'do=changetag' : 'searchtags='. urlencode(escape($_POST['totag']));
+        $count = count($alteredLinks);
         $alert = $delete
-            ? sprintf(t('The tag was removed from %d links.'), count($alteredLinks))
-            : sprintf(t('The tag was renamed in %d links.'), count($alteredLinks));
+            ? sprintf(t('The tag was removed from %d link.', 'The tag was removed from %d links.', $count), $count)
+            : sprintf(t('The tag was renamed in %d link.', 'The tag was renamed in %d links.', $count), $count);
         echo '<script>alert("'. $alert .'");document.location=\'?'. $redirect .'\';</script>';
         exit;
     }
@@ -1450,7 +1455,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
 
             if ($url == '') {
                 $url = '?' . smallHash($linkdate . $LINKSDB->getNextId());
-                $title = $conf->get('general.default_note_title', 'Note: ');
+                $title = $conf->get('general.default_note_title', t('Note: '));
             }
             $url = escape($url);
             $title = escape($title);
@@ -2018,6 +2023,7 @@ function install($conf)
         } else {
             $conf->set('general.title', 'Shared links on '.escape(index_url($_SERVER)));
         }
+        $conf->set('translation.language', escape($_POST['language']));
         $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
         $conf->set('api.enabled', !empty($_POST['enableApi']));
         $conf->set(
@@ -2049,6 +2055,7 @@ function install($conf)
     list($continents, $cities) = generateTimeZoneData(timezone_identifiers_list(), date_default_timezone_get());
     $PAGE->assign('continents', $continents);
     $PAGE->assign('cities', $cities);
+    $PAGE->assign('languages', Languages::getAvailableLanguages());
     $PAGE->renderPage('install');
     exit;
 }