mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-14 21:33:58 +02:00
Translation fix
This commit is contained in:
parent
32a94cf27c
commit
7003a71607
1 changed files with 33 additions and 32 deletions
|
@ -53,6 +53,40 @@ $routeParser = $app->getRouteCollector()->getRouteParser();
|
||||||
|
|
||||||
require_once __DIR__ . '/database.php';
|
require_once __DIR__ . '/database.php';
|
||||||
|
|
||||||
|
$container->set('router', function () use ($routeParser) {
|
||||||
|
return $routeParser;
|
||||||
|
});
|
||||||
|
|
||||||
|
$container->set('db', function () use ($db) {
|
||||||
|
return $db;
|
||||||
|
});
|
||||||
|
|
||||||
|
$container->set('pdo', function () use ($pdo) {
|
||||||
|
return $pdo;
|
||||||
|
});
|
||||||
|
|
||||||
|
$container->set('auth', function() {
|
||||||
|
//$responseFactory = new \Nyholm\Psr7\Factory\Psr17Factory();
|
||||||
|
//$response = $responseFactory->createResponse();
|
||||||
|
//$autoLogout = new \Pinga\Auth\AutoLogout();
|
||||||
|
//$autoLogout->watch(900, '/', null, 301, $response);
|
||||||
|
|
||||||
|
return new \App\Auth\Auth;
|
||||||
|
});
|
||||||
|
|
||||||
|
$container->set('flash', function() {
|
||||||
|
return new \Slim\Flash\Messages;
|
||||||
|
});
|
||||||
|
|
||||||
|
$container->set('view', function ($container) {
|
||||||
|
$view = Twig::create(__DIR__ . '/../resources/views', [
|
||||||
|
'cache' => false,
|
||||||
|
]);
|
||||||
|
$view->getEnvironment()->addGlobal('auth', [
|
||||||
|
'isLogin' => $container->get('auth')->isLogin(),
|
||||||
|
'user' => $container->get('auth')->user(),
|
||||||
|
]);
|
||||||
|
|
||||||
// Known set of languages
|
// Known set of languages
|
||||||
$allowedLanguages = ['en_US', 'uk_UA', 'es_ES']; // Add more as needed
|
$allowedLanguages = ['en_US', 'uk_UA', 'es_ES']; // Add more as needed
|
||||||
|
|
||||||
|
@ -84,39 +118,6 @@ if (!file_exists($languageFile)) {
|
||||||
$loader = new PoLoader();
|
$loader = new PoLoader();
|
||||||
$translations = $loader->loadFile($languageFile);
|
$translations = $loader->loadFile($languageFile);
|
||||||
|
|
||||||
$container->set('router', function () use ($routeParser) {
|
|
||||||
return $routeParser;
|
|
||||||
});
|
|
||||||
|
|
||||||
$container->set('db', function () use ($db) {
|
|
||||||
return $db;
|
|
||||||
});
|
|
||||||
|
|
||||||
$container->set('pdo', function () use ($pdo) {
|
|
||||||
return $pdo;
|
|
||||||
});
|
|
||||||
|
|
||||||
$container->set('auth', function() {
|
|
||||||
//$responseFactory = new \Nyholm\Psr7\Factory\Psr17Factory();
|
|
||||||
//$response = $responseFactory->createResponse();
|
|
||||||
//$autoLogout = new \Pinga\Auth\AutoLogout();
|
|
||||||
//$autoLogout->watch(900, '/', null, 301, $response);
|
|
||||||
|
|
||||||
return new \App\Auth\Auth;
|
|
||||||
});
|
|
||||||
|
|
||||||
$container->set('flash', function() {
|
|
||||||
return new \Slim\Flash\Messages;
|
|
||||||
});
|
|
||||||
|
|
||||||
$container->set('view', function ($container) use ($translations, $uiLang, $lang) {
|
|
||||||
$view = Twig::create(__DIR__ . '/../resources/views', [
|
|
||||||
'cache' => false,
|
|
||||||
]);
|
|
||||||
$view->getEnvironment()->addGlobal('auth', [
|
|
||||||
'isLogin' => $container->get('auth')->isLogin(),
|
|
||||||
'user' => $container->get('auth')->user(),
|
|
||||||
]);
|
|
||||||
$view->getEnvironment()->addGlobal('uiLang', $uiLang);
|
$view->getEnvironment()->addGlobal('uiLang', $uiLang);
|
||||||
$view->getEnvironment()->addGlobal('lang', $lang);
|
$view->getEnvironment()->addGlobal('lang', $lang);
|
||||||
$view->getEnvironment()->addGlobal('flash', $container->get('flash'));
|
$view->getEnvironment()->addGlobal('flash', $container->get('flash'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue