Browse files

Add multlingual support

  • Loading branch information...
1 parent 4418be1 commit b65572406bcecd6b7abdf1e43936f49b29c4ce16 @iam-merlin iam-merlin committed May 9, 2012
View
2 app/config/routes.php 100644 → 100755
@@ -33,6 +33,8 @@
*/
if (file_exists(TMP.'installed.txt')) {
+ Router::connect('/lang/*', array('controller' => 'p28n', 'action' => 'change'));
+
Router::connect('/', array('controller' => 'posts', 'action' => 'display', 'recent'));
Router::connect('/maintenance', array('controller' => 'posts', 'action' => 'maintenance'));
View
17 app/controllers/components/p28n.php
@@ -0,0 +1,17 @@
+<?php
+class P28nComponent extends Object {
+ var $components = array('Session', 'Cookie');
+
+ function startup() {
+ if (!$this->Session->check('Config.language')) {
+ $this->change(($this->Cookie->read('lang') ? $this->Cookie->read('lang') : DEFAULT_LANGUAGE));
+ }
+ }
+
+ function change($lang = null) {
+ if (!empty($lang)) {
+ $this->Session->write('Config.language', $lang);
+ $this->Cookie->write('lang', $lang, null, '+350 day');
+ }
+ }
+}
View
19 app/controllers/p28n_controller.php
@@ -0,0 +1,19 @@
+<?php
+class P28nController extends AppController {
+ var $name = 'P28n';
+ var $uses = null;
+ var $components = array('P28n');
+
+ function change($lang = null) {
+ $this->P28n->change($lang);
+
+ $this->redirect($this->referer(null, true));
+ }
+
+ function shuntRequest() {
+ $this->P28n->change($this->params['lang']);
+
+ $args = func_get_args();
+ $this->redirect("/" . implode("/", $args));
+ }
+}
View
143 app/locale/default.pot
@@ -0,0 +1,143 @@
+# LANGUAGE translation of CakePHP Application
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2012-05-09 05:47+0200\n"
+"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+"Last-Translator: NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: /views/layouts/default.ctp:49
+msgid "login"
+msgstr ""
+
+#: /views/layouts/default.ctp:58
+msgid "register"
+msgstr ""
+
+#: /views/layouts/default.ctp:66;213
+msgid "about"
+msgstr ""
+
+#: /views/layouts/default.ctp:74;97
+msgid "settings"
+msgstr ""
+
+#: /views/layouts/default.ctp:81
+msgid "change language"
+msgstr ""
+
+#: /views/layouts/default.ctp:83
+msgid "english"
+msgstr ""
+
+#: /views/layouts/default.ctp:84
+msgid "french"
+msgstr ""
+
+#: /views/layouts/default.ctp:90
+msgid "admin"
+msgstr ""
+
+#: /views/layouts/default.ctp:104
+msgid "Flagged Posts"
+msgstr ""
+
+#: /views/layouts/default.ctp:111
+msgid "User Management"
+msgstr ""
+
+#: /views/layouts/default.ctp:118
+msgid "Blacklist"
+msgstr ""
+
+#: /views/layouts/default.ctp:125
+msgid "Remote Settings"
+msgstr ""
+
+#: /views/layouts/default.ctp:137
+msgid "logout"
+msgstr ""
+
+#: /views/layouts/default.ctp:152
+msgid "Questions"
+msgstr ""
+
+#: /views/layouts/default.ctp:154
+msgid "Tags"
+msgstr ""
+
+#: /views/layouts/default.ctp:155
+msgid "Unsolved"
+msgstr ""
+
+#: /views/layouts/default.ctp:156
+msgid "Users"
+msgstr ""
+
+#: /views/layouts/default.ctp:161;211
+msgid "ask a question"
+msgstr ""
+
+#: /views/layouts/default.ctp:188
+#: /views/posts/view.ctp:55;237
+msgid "edit"
+msgstr ""
+
+#: /views/layouts/default.ctp:189
+#: /views/posts/view.ctp:62
+msgid "del"
+msgstr ""
+
+#: /views/layouts/default.ctp:199
+msgid "add widgets to this page"
+msgstr ""
+
+#: /views/layouts/default.ctp:210
+msgid "home"
+msgstr ""
+
+#: /views/posts/display.ctp:8
+#: /views/posts/view.ctp:154
+msgid "answer"
+msgid_plural "answers"
+msgstr[0] ""
+msgstr[1] ""
+
+#: /views/posts/display.ctp:12
+msgid "view"
+msgid_plural "views"
+msgstr[0] ""
+msgstr[1] ""
+
+#: /views/posts/view.ctp:47
+msgid "flag"
+msgstr ""
+
+#: /views/posts/view.ctp:146
+msgid "add comment"
+msgstr ""
+
+#: /views/posts/view.ctp:288
+msgid "your answer"
+msgstr ""
+
+#: /views/users/login.ctp:2
+msgid "You are currently an anonymous user. Login below to sign into your account"
+msgstr ""
+
+#: /views/users/user_settings.ctp:2
+msgid "Profile Image"
+msgstr ""
+
+#: /webroot/test.php:99
+msgid "Debug setting does not allow access to this url."
+msgstr ""
+
View
BIN app/locale/fre/LC_MESSAGES/default.mo
Binary file not shown.
View
148 app/locale/fre/LC_MESSAGES/default.po
@@ -0,0 +1,148 @@
+# LANGUAGE translation of CakePHP Application
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Coordino\n"
+"POT-Creation-Date: 2012-05-09 05:47+0200\n"
+"PO-Revision-Date: 2012-05-09 05:48+0100\n"
+"Last-Translator: Romain DARY <romain.dary@eoko.fr>\n"
+"Language-Team: Eoko <romain.dary@eoko.fr>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n>1;\n"
+"X-Poedit-Language: French\n"
+"X-Poedit-Country: FRANCE\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+#: /views/layouts/default.ctp:49
+msgid "login"
+msgstr "connexion"
+
+#: /views/layouts/default.ctp:58
+msgid "register"
+msgstr "s'enregistrer"
+
+#: /views/layouts/default.ctp:66;213
+msgid "about"
+msgstr "à propos"
+
+#: /views/layouts/default.ctp:74;97
+msgid "settings"
+msgstr "paramètres"
+
+#: /views/layouts/default.ctp:81
+msgid "change language"
+msgstr "changer de langue"
+
+#: /views/layouts/default.ctp:83
+msgid "english"
+msgstr "anglais"
+
+#: /views/layouts/default.ctp:84
+msgid "french"
+msgstr "français"
+
+#: /views/layouts/default.ctp:90
+msgid "admin"
+msgstr "admin"
+
+#: /views/layouts/default.ctp:104
+msgid "Flagged Posts"
+msgstr "Contribution signalé"
+
+#: /views/layouts/default.ctp:111
+msgid "User Management"
+msgstr "Gestion des membres"
+
+#: /views/layouts/default.ctp:118
+msgid "Blacklist"
+msgstr "Liste noire"
+
+#: /views/layouts/default.ctp:125
+msgid "Remote Settings"
+msgstr "Paramètres distants"
+
+#: /views/layouts/default.ctp:137
+msgid "logout"
+msgstr "Déconnexion"
+
+#: /views/layouts/default.ctp:152
+msgid "Questions"
+msgstr "Questions"
+
+#: /views/layouts/default.ctp:154
+msgid "Tags"
+msgstr "Mot-clés"
+
+#: /views/layouts/default.ctp:155
+msgid "Unsolved"
+msgstr "Non-résolue"
+
+#: /views/layouts/default.ctp:156
+msgid "Users"
+msgstr "Utilisateur"
+
+#: /views/layouts/default.ctp:161;211
+msgid "ask a question"
+msgstr "poser une question"
+
+#: /views/layouts/default.ctp:188
+#: /views/posts/view.ctp:55;237
+msgid "edit"
+msgstr "édit"
+
+#: /views/layouts/default.ctp:189
+#: /views/posts/view.ctp:62
+msgid "del"
+msgstr "suppr"
+
+#: /views/layouts/default.ctp:199
+msgid "add widgets to this page"
+msgstr "ajouter des widgets à cette page"
+
+#: /views/layouts/default.ctp:210
+msgid "home"
+msgstr "accueil"
+
+#: /views/posts/display.ctp:8
+#: /views/posts/view.ctp:154
+msgid "answer"
+msgid_plural "answers"
+msgstr[0] "réponse"
+msgstr[1] "réponses"
+
+#: /views/posts/display.ctp:12
+msgid "view"
+msgid_plural "views"
+msgstr[0] "vue"
+msgstr[1] "vues"
+
+#: /views/posts/view.ctp:47
+msgid "flag"
+msgstr "signaler"
+
+#: /views/posts/view.ctp:146
+msgid "add comment"
+msgstr "ajouter un commentaire"
+
+#: /views/posts/view.ctp:288
+#, fuzzy
+msgid "your answer"
+msgstr "réponse"
+
+#: /views/users/login.ctp:2
+msgid "You are currently an anonymous user. Login below to sign into your account"
+msgstr "Vous êtes actuellement un utilisateur anonyme. Veuillez vous identifier ci-dessous pour acceder à votre compte."
+
+#: /views/users/user_settings.ctp:2
+msgid "Profile Image"
+msgstr "Image de profile"
+
+#: /webroot/test.php:99
+msgid "Debug setting does not allow access to this url."
+msgstr ""
+
+#~ msgid "ask a Question"
+#~ msgstr "poser une question"
View
28 app/locale/fre/LC_MESSAGES/default.pot
@@ -0,0 +1,28 @@
+# LANGUAGE translation of CakePHP Application
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2012-05-09 03:18+0200\n"
+"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+"Last-Translator: NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: /views/users/login.ctp:2
+msgid "You are currently an anonymous user. Login below to sign into your account"
+msgstr ""
+
+#: /views/users/user_settings.ctp:2
+msgid "Profile Image"
+msgstr ""
+
+#: /webroot/test.php:99
+msgid "Debug setting does not allow access to this url."
+msgstr ""
+

0 comments on commit b655724

Please sign in to comment.