summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-27 16:45:16 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-27 16:45:16 +0200
commit70d75f0cf5304c1f8ef121538f9e4e166bb7b755 (patch)
treed9efb364cbcdfb7db92734937a68a42db7c5e123 /app
parent70e7d09b967b903aed4d97d7eb66800f395f838c (diff)
Possibilité de choisir la langue à utiliser + fin traduction en anglais (bug #38)
Diffstat (limited to 'app')
-rw-r--r--app/App_FrontController.php6
-rwxr-xr-xapp/controllers/configureController.php6
-rw-r--r--app/i18n/en.php5
-rw-r--r--app/i18n/fr.php1
-rwxr-xr-xapp/models/RSSConfiguration.php26
-rw-r--r--app/views/configure/display.phtml12
6 files changed, 50 insertions, 6 deletions
diff --git a/app/App_FrontController.php b/app/App_FrontController.php
index 177e83b66..8b515873a 100644
--- a/app/App_FrontController.php
+++ b/app/App_FrontController.php
@@ -11,12 +11,12 @@ class App_FrontController extends FrontController {
$this->loadModels ();
Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?)
- Session::_param ('language', 'fr');
- Translate::init ();
$this->loadParamsView ();
$this->loadStylesAndScripts ();
$this->loadNotifications ();
+
+ Translate::init ();
}
private function loadLibs () {
@@ -41,6 +41,8 @@ class App_FrontController extends FrontController {
$entryDAO = new EntryDAO ();
View::_param ('nb_not_read', $entryDAO->countNotRead ());
+
+ Session::_param ('language', $this->conf->language ());
}
private function loadStylesAndScripts () {
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php
index 11b55f4b0..81a8e97d7 100755
--- a/app/controllers/configureController.php
+++ b/app/controllers/configureController.php
@@ -124,6 +124,7 @@ class configureController extends ActionController {
public function displayAction () {
if (Request::isPost ()) {
+ $language = Request::param ('language', 'en');
$nb = Request::param ('posts_per_page', 10);
$view = Request::param ('default_view', 'all');
$display = Request::param ('display_posts', 'no');
@@ -135,6 +136,7 @@ class configureController extends ActionController {
$openPage = Request::param ('mark_open_page', 'no');
$urlShaarli = Request::param ('shaarli', '');
+ $this->view->conf->_language ($language);
$this->view->conf->_postsPerPage (intval ($nb));
$this->view->conf->_defaultView ($view);
$this->view->conf->_displayPosts ($display);
@@ -149,6 +151,7 @@ class configureController extends ActionController {
$this->view->conf->_urlShaarli ($urlShaarli);
$values = array (
+ 'language' => $this->view->conf->language (),
'posts_per_page' => $this->view->conf->postsPerPage (),
'default_view' => $this->view->conf->defaultView (),
'display_posts' => $this->view->conf->displayPosts (),
@@ -164,6 +167,9 @@ class configureController extends ActionController {
Session::_param ('conf', $this->view->conf);
Session::_param ('mail', $this->view->conf->mailLogin ());
+ Session::_param ('language', $this->view->conf->language ());
+ Translate::reset ();
+
// notif
$notif = array (
'type' => 'good',
diff --git a/app/i18n/en.php b/app/i18n/en.php
index 23b2ae17b..203904c9d 100644
--- a/app/i18n/en.php
+++ b/app/i18n/en.php
@@ -131,6 +131,7 @@ return array (
'think_to_add' => 'Think to add RSS feeds!',
'general_configuration' => 'General configuration',
+ 'language' => 'Language',
'delete_articles_every' => 'Remove articles every',
'month' => 'months',
'persona_connection_email' => 'Login mail address (use <a href="https://persona.org/">Persona</a>)',
@@ -180,9 +181,9 @@ return array (
'github_or_email' => '<a href="https://github.com/marienfressinaud/FreshRSS/issues">on Github</a> or <a href="mailto:dev@marienfressinaud.fr">by mail</a>',
'license' => 'License',
'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>',
- 'freshrss_description' => 'FreshRSS est un agrégateur de flux RSS à auto-héberger à l\'image de <a href="http://rsslounge.aditu.de/">RSSLounge</a>, <a href="http://tt-rss.org/redmine/projects/tt-rss/wiki">TinyTinyRSS</a> ou <a href="http://projet.idleman.fr/leed/">Leed</a>. Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. L\'objectif étant d\'offrir une alternative sérieuse au futur feu-Google Reader.',
+ 'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like <a href="http://rsslounge.aditu.de/">RSSLounge</a>, <a href="http://tt-rss.org/redmine/projects/tt-rss/wiki">TinyTinyRSS</a> or <a href="http://projet.idleman.fr/leed/">Leed</a>. It is light and easy to take in hand while being powerful and configurable tool. Objective is to provide a serious alternative to Google Reader.',
'credits' => 'Credits',
- 'credits_content' => 'Des éléments de design sont issus du <a href="http://twitter.github.io/bootstrap/">projet Bootstrap</a> bien que FreshRSS n\'utilise pas ce framework. Les <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">icônes</a> sont issues du <a href="https://www.gnome.org/">projet GNOME</a>. La police <em>Open Sans</em> utilisée a été créée par <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a>. Les favicons sont récupérés grâce au site <a href="https://getfavicon.appspot.com/">getFavicon</a>. FreshRSS repose sur <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.',
+ 'credits_content' => 'Some design elements come from <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> although FreshRSS doesn\'t use this framework. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> come from <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> font police used has been created by <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a>. Favicons are collected with <a href="https://getfavicon.appspot.com/">getFavicon API</a>. FreshRSS is based on <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, a PHP framework.',
// DATE
'january' => 'january',
diff --git a/app/i18n/fr.php b/app/i18n/fr.php
index 39208cef8..0473a8f94 100644
--- a/app/i18n/fr.php
+++ b/app/i18n/fr.php
@@ -131,6 +131,7 @@ return array (
'think_to_add' => 'Pensez à en ajouter !',
'general_configuration' => 'Configuration générale',
+ 'language' => 'Langue',
'delete_articles_every' => 'Supprimer les articles tous les',
'month' => 'mois',
'persona_connection_email' => 'Adresse mail de connexion (utilise <a href="https://persona.org/">Persona</a>)',
diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php
index ca56ec3a8..00fe3fe52 100755
--- a/app/models/RSSConfiguration.php
+++ b/app/models/RSSConfiguration.php
@@ -1,6 +1,11 @@
<?php
class RSSConfiguration extends Model {
+ private $available_languages = array (
+ 'en' => 'English',
+ 'fr' => 'Français',
+ );
+ private $language;
private $posts_per_page;
private $default_view;
private $display_posts;
@@ -13,6 +18,7 @@ class RSSConfiguration extends Model {
public function __construct () {
$confDAO = new RSSConfigurationDAO ();
+ $this->_language ($confDAO->language);
$this->_postsPerPage ($confDAO->posts_per_page);
$this->_defaultView ($confDAO->default_view);
$this->_displayPosts ($confDAO->display_posts);
@@ -24,6 +30,12 @@ class RSSConfiguration extends Model {
$this->_urlShaarli ($confDAO->url_shaarli);
}
+ public function availableLanguages () {
+ return $this->available_languages;
+ }
+ public function language () {
+ return $this->language;
+ }
public function postsPerPage () {
return $this->posts_per_page;
}
@@ -60,7 +72,13 @@ class RSSConfiguration extends Model {
public function urlShaarli () {
return $this->url_shaarli;
}
-
+
+ public function _language ($value) {
+ if (!isset ($this->available_languages[$value])) {
+ $value = 'en';
+ }
+ $this->language = $value;
+ }
public function _postsPerPage ($value) {
if (is_int (intval ($value))) {
$this->posts_per_page = $value;
@@ -122,6 +140,7 @@ class RSSConfiguration extends Model {
}
class RSSConfigurationDAO extends Model_array {
+ public $language = 'en';
public $posts_per_page = 20;
public $default_view = 'not_read';
public $display_posts = 'no';
@@ -146,7 +165,10 @@ class RSSConfigurationDAO extends Model_array {
public function __construct () {
parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php');
-
+
+ if (isset ($this->array['language'])) {
+ $this->language = $this->array['language'];
+ }
if (isset ($this->array['posts_per_page'])) {
$this->posts_per_page = $this->array['posts_per_page'];
}
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml
index fcae83d9a..be67896dc 100644
--- a/app/views/configure/display.phtml
+++ b/app/views/configure/display.phtml
@@ -7,6 +7,18 @@
<legend><?php echo Translate::t ('general_configuration'); ?></legend>
<div class="form-group">
+ <label class="group-name" for="language"><?php echo Translate::t ('language'); ?></label>
+ <div class="group-controls">
+ <select name="language" id="language">
+ <?php $languages = $this->conf->availableLanguages (); ?>
+ <?php foreach ($languages as $short => $lib) { ?>
+ <option value="<?php echo $short; ?>"<?php echo $this->conf->language () == $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
+ <?php } ?>
+ </select>
+ </div>
+ </div>
+
+ <div class="form-group">
<label class="group-name" for="old_entries"><?php echo Translate::t ('delete_articles_every'); ?></label>
<div class="group-controls">
<input type="number" id="old_entries" name="old_entries" value="<?php echo $this->conf->oldEntries (); ?>" /> <?php echo Translate::t ('month'); ?>