mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-20 10:14:33 -04:00
Possibilité de choisir la langue à utiliser + fin traduction en anglais (bug #38)
This commit is contained in:
1 parent
70e7d09b96
commit
70d75f0cf5
6 files changed
+50
-6
No files matched your search
@@ -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 () {
|
||||
|
||||
@@ -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',
|
||||
|
||||
+3
-2
@@ -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',
|
||||
|
||||
@@ -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>)',
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
@@ -6,6 +6,18 @@
|
||||
<form method="post" action="<?php echo _url ('configure', 'display'); ?>">
|
||||
<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">
|
||||
|
||||
Reference in new issue
Block a user