diff --git a/CREDITS b/CREDITS
index c917a01..77a3f66 100644
--- a/CREDITS
+++ b/CREDITS
@@ -6,6 +6,7 @@ poche is based on :
* icons http://icomoon.io
* PHP Simple HTML DOM Parser (for Pocket import) http://simplehtmldom.sourceforge.net/
* Session https://github.com/tontof/kriss_feed/blob/master/src/class/Session.php
+* RainTPL http://www.raintpl.com/
poche is developed by Nicolas Lœuillet under the Do What the Fuck You Want to Public License
diff --git a/import.php b/import.php
index c1ebdf4..45fe833 100644
--- a/import.php
+++ b/import.php
@@ -14,11 +14,7 @@ include dirname(__FILE__).'/inc/config.php';
include dirname(__FILE__).'/inc/simple_html_dom.php';
if (!isset($_GET['start'])) {
- echo '
- Please execute the import script locally, it can take a very long time.
- Please choose between Pocket & Readabilty :
-
Bye bye Pocket, let\'s go !
-
Bye bye Readability, let\'s go !';
+ echo _('Please execute the import script locally, it can take a very long time.') . '
' . _('Please choose between Pocket & Readabilty :') . '
' . _('Bye bye Pocket, let\'s go !') . '
' . _('Bye bye Readability, let\'s go !') . '';
}
else {
if ($_GET['start'] == 'pocket') {
@@ -49,7 +45,7 @@ else {
$read = 1;
}
- echo 'Import from Pocket completed. Welcome to #poche !';
+ echo _('Import from Pocket completed.') . '' . _('Welcome to poche !') .'';
logm('import from pocket completed');
}
else if ($_GET['start'] == 'readability') {
@@ -67,11 +63,11 @@ else {
action_to_do('add', $url);
}
- echo 'Import from Readability completed. Welcome to #poche !';
+ echo _('Import from Readability completed.') . '' . _('Welcome to poche !') . '';
logm('import from Readability completed');
}
else {
- echo 'Error with the import. Welcome to #poche !';
+ echo _('Error with the import.') . '' . _('Back to poche'). '';
logm('error with the import');
}
}
\ No newline at end of file
diff --git a/inc/MyTool.class.php b/inc/MyTool.class.php
index 1f5051a..b11f18e 100644
--- a/inc/MyTool.class.php
+++ b/inc/MyTool.class.php
@@ -15,7 +15,7 @@ class MyTool
define('START_TIME', microtime(true));
if (phpversion() < 5) {
- die("Argh you don't have PHP 5 !");
+ die(_('Oops, it seems you don\'t have PHP 5.'));
}
error_reporting(E_ALL);
diff --git a/inc/config.php b/inc/config.php
index 4b46366..6e3f80b 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -20,6 +20,13 @@ define ('CONVERT_LINKS_FOOTNOTES', TRUE);
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS',FALSE);
define ('DOWNLOAD_PICTURES', TRUE);
define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
+define ('LANG', 'fr_FR.UTF8');
+
+putenv("LC_ALL=".LANG);
+setlocale(LC_ALL, LANG);
+bindtextdomain(LANG, "./locale");
+textdomain(LANG);
+
$storage_type = 'sqlite'; # sqlite or file
include 'functions.php';
diff --git a/inc/functions.php b/inc/functions.php
index 73e591c..34ecf51 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -349,19 +349,19 @@ function action_to_do($action, $url, $id = 0)
if (DOWNLOAD_PICTURES) {
$content = filtre_picture($parametres_url['content'], $url, $last_id);
}
- $msg->add('s', 'the link has been added successfully');
+ $msg->add('s', _('the link has been added successfully'));
}
else {
- $msg->add('e', 'error during insertion : the link wasn\'t added');
+ $msg->add('e', _('error during insertion : the link wasn\'t added'));
}
}
else {
- $msg->add('e', 'error during url preparation : the link wasn\'t added');
+ $msg->add('e', _('error during url preparation : the link wasn\'t added'));
logm('error during url preparation');
}
}
else {
- $msg->add('e', 'error during url preparation : the link is not valid');
+ $msg->add('e', _('error during url preparation : the link is not valid'));
logm($url . ' is not a valid url');
}
@@ -370,11 +370,11 @@ function action_to_do($action, $url, $id = 0)
case 'delete':
if ($store->deleteById($id)) {
remove_directory(ABS_PATH . $id);
- $msg->add('s', 'the link has been deleted successfully');
+ $msg->add('s', _('the link has been deleted successfully'));
logm('delete link #' . $id);
}
else {
- $msg->add('e', 'the link wasn\'t deleted');
+ $msg->add('e', _('the link wasn\'t deleted'));
logm('error : can\'t delete link #' . $id);
}
break;
diff --git a/index.php b/index.php
index 5de8f7f..fdaeabc 100644
--- a/index.php
+++ b/index.php
@@ -15,7 +15,7 @@ myTool::initPhp();
# XSRF protection with token
if (!empty($_POST)) {
if (!Session::isToken($_POST['token'])) {
- die('Wrong token.');
+ die(_('Wrong token.'));
}
unset($_SESSION['tokens']);
}
@@ -40,7 +40,7 @@ if (isset($_GET['login'])) {
MyTool::redirect($ref);
}
logm('login failed');
- die("Login failed !");
+ die(_("Login failed !"));
} else {
logm('login failed');
}
@@ -56,14 +56,14 @@ elseif (isset($_GET['config'])) {
logm('password updated');
if (!MODE_DEMO) {
$store->updatePassword(encode_string($_POST['password'] . $_SESSION['login']));
- $msg->add('s', 'your password has been updated');
+ $msg->add('s', _('your password has been updated'));
}
else {
- $msg->add('i', 'in demo mode, you can\'t update password');
+ $msg->add('i', _('in demo mode, you can\'t update password'));
}
}
else
- $msg->add('e', 'your password can\'t be empty and you have to repeat it in the second field');
+ $msg->add('e', _('your password can\'t be empty and you have to repeat it in the second field'));
}
}
@@ -80,7 +80,7 @@ $tpl->assign('referer', $ref);
$tpl->assign('view', $view);
$tpl->assign('poche_url', myTool::getUrl());
$tpl->assign('demo', MODE_DEMO);
-$tpl->assign('title', 'poche, a read it later open source system');
+$tpl->assign('title', _('poche, a read it later open source system'));
if (Session::isLogged()) {
action_to_do($action, $url, $id);
diff --git a/locale/fr_FR.UTF8/LC_MESSAGES/fr_FR.UTF8.mo b/locale/fr_FR.UTF8/LC_MESSAGES/fr_FR.UTF8.mo
new file mode 100644
index 0000000..d996d46
Binary files /dev/null and b/locale/fr_FR.UTF8/LC_MESSAGES/fr_FR.UTF8.mo differ
diff --git a/locale/fr_FR.UTF8/LC_MESSAGES/fr_FR.UTF8.po b/locale/fr_FR.UTF8/LC_MESSAGES/fr_FR.UTF8.po
new file mode 100644
index 0000000..d4e7f2e
--- /dev/null
+++ b/locale/fr_FR.UTF8/LC_MESSAGES/fr_FR.UTF8.po
@@ -0,0 +1,111 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: poche\n"
+"POT-Creation-Date: 2013-08-02 10:26+0100\n"
+"PO-Revision-Date: 2013-08-02 10:26+0100\n"
+"Last-Translator: Nicolas Lœuillet \n"
+"Language-Team: poche \n"
+"Language: Français\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.4\n"
+"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
+"X-Poedit-Basepath: /\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+"X-Poedit-SearchPath-0: /var/www/poche-i18n\n"
+
+#: /var/www/poche-i18n/import.php:17
+msgid "Please execute the import script locally, it can take a very long time."
+msgstr "Merci d'exécuter l'import en local, cela peut prendre du temps. "
+
+#: /var/www/poche-i18n/import.php:17
+msgid "Please choose between Pocket & Readabilty :"
+msgstr "Merci de choisir entre Pocket & Readability :"
+
+#: /var/www/poche-i18n/import.php:17
+msgid "Bye bye Pocket, let's go !"
+msgstr "Bye bye Pocket, en route !"
+
+#: /var/www/poche-i18n/import.php:17
+msgid "Bye bye Readability, let's go !"
+msgstr "Bye bye Readability, en route !"
+
+#: /var/www/poche-i18n/import.php:48
+msgid "Import from Pocket completed."
+msgstr "L'import depuis Poche est terminé."
+
+#: /var/www/poche-i18n/import.php:48 /var/www/poche-i18n/import.php:66
+msgid "Welcome to poche !"
+msgstr "Bienvenue dans poche !"
+
+#: /var/www/poche-i18n/import.php:66
+msgid "Import from Readability completed."
+msgstr "L'import depuis Readability est terminé."
+
+#: /var/www/poche-i18n/import.php:70
+msgid "Error with the import."
+msgstr "Erreur durant l'import."
+
+#: /var/www/poche-i18n/import.php:70
+msgid "Back to poche"
+msgstr "Retour à poche"
+
+#: /var/www/poche-i18n/index.php:18
+msgid "Wrong token."
+msgstr "Mauvais jeton."
+
+#: /var/www/poche-i18n/index.php:43
+msgid "Login failed !"
+msgstr "Connexion échouée."
+
+#: /var/www/poche-i18n/index.php:59
+msgid "your password has been updated"
+msgstr "Votre mot de passe a été mis à jour. "
+
+#: /var/www/poche-i18n/index.php:62
+msgid "in demo mode, you can't update password"
+msgstr "En mode démo, le mot de passe ne peut être modifié."
+
+#: /var/www/poche-i18n/index.php:66
+msgid ""
+"your password can't be empty and you have to repeat it in the second field"
+msgstr ""
+"Votre mot de passe ne peut être vide et vous devez le répéter dans le second "
+"champ."
+
+#: /var/www/poche-i18n/index.php:83
+msgid "poche, a read it later open source system"
+msgstr "poche, a read it later open source system"
+
+#: /var/www/poche-i18n/inc/MyTool.class.php:18
+msgid "Oops, it seems you don't have PHP 5."
+msgstr "Oups, il semblerait que PHP 5 ne soit pas installé. "
+
+#: /var/www/poche-i18n/inc/functions.php:352
+msgid "the link has been added successfully"
+msgstr "le lien a été ajouté avec succès"
+
+#: /var/www/poche-i18n/inc/functions.php:355
+msgid "error during insertion : the link wasn't added"
+msgstr "erreur durant l'insertion : le lien n'a pas été ajouté"
+
+#: /var/www/poche-i18n/inc/functions.php:359
+msgid "error during url preparation : the link wasn't added"
+msgstr "erreur durant l'insertion : le lien n'a pas été ajouté"
+
+#: /var/www/poche-i18n/inc/functions.php:364
+msgid "error during url preparation : the link is not valid"
+msgstr "erreur durant la préparation de l'URL : le lien n'est pas valide"
+
+#: /var/www/poche-i18n/inc/functions.php:373
+msgid "the link has been deleted successfully"
+msgstr "le lien a été ajouté avec succès"
+
+#: /var/www/poche-i18n/inc/functions.php:377
+msgid "the link wasn't deleted"
+msgstr "le lien n'a pas été supprimé"
+
+#~ msgid "TEST"
+#~ msgstr "NICOLAS"