|
@@ -1,6 +1,7 @@
|
|
<?php
|
|
<?php
|
|
|
|
|
|
use App\Database\DB;
|
|
use App\Database\DB;
|
|
|
|
+use App\Web\Lang;
|
|
use App\Web\Session;
|
|
use App\Web\Session;
|
|
use Monolog\Formatter\LineFormatter;
|
|
use Monolog\Formatter\LineFormatter;
|
|
use Monolog\Handler\RotatingFileHandler;
|
|
use Monolog\Handler\RotatingFileHandler;
|
|
@@ -27,6 +28,7 @@ $config = array_replace_recursive([
|
|
'username' => null,
|
|
'username' => null,
|
|
'password' => null,
|
|
'password' => null,
|
|
],
|
|
],
|
|
|
|
+ 'lang' => 'en',
|
|
], require __DIR__ . '/../config.php');
|
|
], require __DIR__ . '/../config.php');
|
|
|
|
|
|
if (!$config['displayErrorDetails']) {
|
|
if (!$config['displayErrorDetails']) {
|
|
@@ -57,6 +59,12 @@ $container['database'] = function ($container) use (&$config) {
|
|
return DB::getInstance();
|
|
return DB::getInstance();
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+Lang::build($config['lang'], __DIR__. '/../resources/lang/');
|
|
|
|
+
|
|
|
|
+$container['lang'] = function ($container) {
|
|
|
|
+ return Lang::getInstance();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
|
|
$container['view'] = function ($container) use (&$config) {
|
|
$container['view'] = function ($container) use (&$config) {
|
|
$view = new \Slim\Views\Twig(__DIR__ . '/../resources/templates', [
|
|
$view = new \Slim\Views\Twig(__DIR__ . '/../resources/templates', [
|
|
@@ -75,6 +83,7 @@ $container['view'] = function ($container) use (&$config) {
|
|
$view->getEnvironment()->addGlobal('request', $container->get('request'));
|
|
$view->getEnvironment()->addGlobal('request', $container->get('request'));
|
|
$view->getEnvironment()->addGlobal('alerts', Session::getAlert());
|
|
$view->getEnvironment()->addGlobal('alerts', Session::getAlert());
|
|
$view->getEnvironment()->addGlobal('session', Session::all());
|
|
$view->getEnvironment()->addGlobal('session', Session::all());
|
|
|
|
+ $view->getEnvironment()->addGlobal('lang', $container->get('lang'));
|
|
$view->getEnvironment()->addGlobal('PLATFORM_VERSION', PLATFORM_VERSION);
|
|
$view->getEnvironment()->addGlobal('PLATFORM_VERSION', PLATFORM_VERSION);
|
|
return $view;
|
|
return $view;
|
|
};
|
|
};
|