diff --git a/index.php b/index.php
index 21b225d..d9d8341 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,8 @@
register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/templates',
));
-$app->get('/', function () use ($app) {
- return $app['twig']->render('index.twig', array(
- ));
+$app->register(new Silex\Provider\TranslationServiceProvider(), array(
+ 'locale_fallback' => 'de',
+));
+
+$app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
+ $translator->addResource('xliff', __DIR__.'/locales/de.xml', 'de');
+ $translator->addResource('xliff', __DIR__.'/locales/en.xml', 'en');
+
+ return $translator;
+}));
+
+$app->before(function(Request $request) use ($app){
+ $lang = $request->getPreferredLanguage(array('en', 'de'));
+ $app['translator']->setLocale($lang);
});
-$app->post('/', function () use ($app) {
- return $app['twig']->render('index.twig', array(
+$app->get('/', function (Request $request) use ($app) {
+ return $app['twig']->render('registration_form.twig', array(
+ 'errors' => array(),
));
});
-
$app->run();
diff --git a/locales/de.xml b/locales/de.xml
new file mode 100644
index 0000000..8fc6e13
--- /dev/null
+++ b/locales/de.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/locales/en.xml b/locales/en.xml
new file mode 100644
index 0000000..a5bc4b5
--- /dev/null
+++ b/locales/en.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+ Register an xmpp account
+
+
+
+
diff --git a/templates/registration_form.twig b/templates/registration_form.twig
index 5b1ed0a..b0d163d 100644
--- a/templates/registration_form.twig
+++ b/templates/registration_form.twig
@@ -6,7 +6,7 @@
-
Ein XMPP-Konto registrieren
+ {% trans %}Ein XMPP-Konto registrieren{% endtrans %}
@@ -19,53 +19,53 @@