diff --git a/agents/toplevel/HtmlAgent.inc b/agents/toplevel/HtmlAgent.inc
index e131fdf2..63ed4525 100644
--- a/agents/toplevel/HtmlAgent.inc
+++ b/agents/toplevel/HtmlAgent.inc
@@ -17,12 +17,21 @@
*
* @author Oliver Hanraths
*/
- class HtmlAgent extends \nre\agents\ToplevelAgent
+ class HtmlAgent extends \hhu\z\ToplevelAgent
{
+ protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
+ {
+ parent::__construct($request, $response, $log);
+
+
+ $this->setLanguage($request);
+ }
+
+
/**
* Action: index.
*/
@@ -32,6 +41,27 @@
$this->addSubAgent('Menu');
}
+
+
+
+ private function setLanguage(\nre\core\Request $request)
+ {
+ // Set domain
+ $domain = \nre\configs\AppConfig::$app['name'];
+
+ // Get language
+ $locale = $request->getGetParam('lang', 'language');
+ if(is_null($locale)) {
+ return;
+ }
+
+ // Load translation
+ putenv("LC_ALL=$locale");
+ setlocale(LC_ALL, $locale);
+ bindtextdomain($domain, ROOT.DS.\nre\configs\AppConfig::$dirs['locale']);
+ textdomain($domain);
+ }
+
}
?>
diff --git a/app/Controller.inc b/app/Controller.inc
index 55509fbb..4403407b 100644
--- a/app/Controller.inc
+++ b/app/Controller.inc
@@ -44,9 +44,6 @@
public function __construct($layoutName, $action, $agent)
{
parent::__construct($layoutName, $action, $agent);
-
- // Set timezone
- date_default_timezone_set(\nre\configs\AppConfig::$app['timeZone']);
}
diff --git a/app/ToplevelAgent.inc b/app/ToplevelAgent.inc
new file mode 100644
index 00000000..97aea57b
--- /dev/null
+++ b/app/ToplevelAgent.inc
@@ -0,0 +1,36 @@
+
+ * @copyright 2014 Heinrich-Heine-Universität Düsseldorf
+ * @license http://www.gnu.org/licenses/gpl.html
+ * @link https://bitbucket.org/coderkun/the-legend-of-z
+ */
+
+ namespace hhu\z;
+
+
+ /**
+ * Abstract class for implementing an application Controller.
+ *
+ * @author Oliver Hanraths
+ */
+ abstract class ToplevelAgent extends \nre\agents\ToplevelAgent
+ {
+
+
+
+
+ protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
+ {
+ parent::__construct($request, $response, $log);
+
+
+ // Set timezone
+ date_default_timezone_set(\nre\configs\AppConfig::$app['timeZone']);
+ }
+ }
+
+?>
diff --git a/configs/AppConfig.inc b/configs/AppConfig.inc
index 8f5ab347..3467c3be 100644
--- a/configs/AppConfig.inc
+++ b/configs/AppConfig.inc
@@ -30,6 +30,7 @@
* @var array
*/
public static $app = array(
+ 'name' => 'The Legend of Z',
'namespace' => 'hhu\\z\\',
'timeZone' => 'Europe/Berlin'
);
@@ -45,7 +46,19 @@
'toplevel' => 'html',
'toplevel-error' => 'fault',
'intermediate' => 'introduction',
- 'intermediate-error' => 'error'
+ 'intermediate-error' => 'error',
+ 'language' => 'de_DE.utf8'
+ );
+
+
+ /**
+ * Directories
+ *
+ * @static
+ * @var array
+ */
+ public static $dirs = array(
+ 'locale' => 'locale'
);
diff --git a/controllers/SeminariesController.inc b/controllers/SeminariesController.inc
index 85867cbb..4f026f41 100644
--- a/controllers/SeminariesController.inc
+++ b/controllers/SeminariesController.inc
@@ -65,6 +65,9 @@
// Get seminary
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
+ // Created user
+ $seminary['creator'] = $this->Users->getUserById($seminary['created_user_id']);
+
// Pass data to view
$this->set('seminary', $seminary);
diff --git a/locale/de_DE/LC_MESSAGES/The Legend of Z.mo b/locale/de_DE/LC_MESSAGES/The Legend of Z.mo
new file mode 100644
index 00000000..ec51389a
Binary files /dev/null and b/locale/de_DE/LC_MESSAGES/The Legend of Z.mo differ
diff --git a/locale/de_DE/LC_MESSAGES/The Legend of Z.po b/locale/de_DE/LC_MESSAGES/The Legend of Z.po
new file mode 100644
index 00000000..e216dbb5
--- /dev/null
+++ b/locale/de_DE/LC_MESSAGES/The Legend of Z.po
@@ -0,0 +1,45 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: The Legend of Z\n"
+"POT-Creation-Date: 2014-01-19 22:56+0100\n"
+"PO-Revision-Date: 2014-01-19 22:58+0100\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: de_DE\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.6.3\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+"X-Poedit-SearchPath-0: ../../../views\n"
+
+#: ../../../views/html/menu/index.tpl:2 ../../../views/html/users/user.tpl:1
+#: ../../../views/html/users/index.tpl:1
+msgid "Users"
+msgstr "Benutzer"
+
+#: ../../../views/html/menu/index.tpl:3
+#: ../../../views/html/seminaries/seminary.tpl:1
+#: ../../../views/html/seminaries/index.tpl:1
+msgid "Seminaries"
+msgstr "Kurse"
+
+#: ../../../views/html/users/user.tpl:4 ../../../views/html/users/index.tpl:7
+msgid "registered on"
+msgstr "registriert seit"
+
+#: ../../../views/html/error/index.tpl:1
+msgid "Error"
+msgstr "Fehler"
+
+#: ../../../views/html/seminaries/seminary.tpl:4
+#: ../../../views/html/seminaries/index.tpl:7
+#, php-format
+msgid "created by %s on %s"
+msgstr "erstellt von %s am %s"
+
+#: ../../../views/html/introduction/index.tpl:1
+msgid "Introduction"
+msgstr "Einführung"
diff --git a/views/html/error/index.tpl b/views/html/error/index.tpl
index f7e42500..0f68bc07 100644
--- a/views/html/error/index.tpl
+++ b/views/html/error/index.tpl
@@ -1,2 +1,2 @@
-Fehler
+=_('Error')?>
=$code?>: =$string?>
diff --git a/views/html/html.tpl b/views/html/html.tpl
index 9401a5e5..0f46493c 100644
--- a/views/html/html.tpl
+++ b/views/html/html.tpl
@@ -16,7 +16,6 @@
- =$title?>
=$intermediate?>