38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Tell\I18n;
|
|
use Psr\Container\ContainerInterface;
|
|
use Notes\Tell\LanguageHandler;
|
|
|
|
use function DI\autowire, DI\create, DI\get, DI\add;
|
|
|
|
return [
|
|
I18n::class => function(ContainerInterface $container) {
|
|
$i18n = new I18n($container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), $container->get('tell.fallback'));
|
|
$i18n->locale(getenv('DEFAULT_LOCAL'));
|
|
$i18n->initialize(! getenv("DEBUG"));
|
|
|
|
return $i18n;
|
|
},
|
|
|
|
'tell.fallback' => function(ContainerInterface $container) {
|
|
$i18n = new Tell\I18n( $container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
|
|
$i18n->locale(getenv('DEFAULT_LOCAL_FALLBACK') ?: "en_US");
|
|
$i18n->initialize(true);
|
|
|
|
return $i18n;
|
|
},
|
|
|
|
Tell\Reader\PhpReader::class => function(ContainerInterface $container) {
|
|
return new Tell\Reader\PhpReader($container->get(Lean\Lean::class)->getI18n('php'), false);
|
|
},
|
|
|
|
Tell\Reader\JsonReader::class => function(ContainerInterface $container) {
|
|
return new Tell\Reader\JsonReader($container->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
|
|
},
|
|
|
|
'lean.autoload' => add([
|
|
I18n::class,
|
|
]),
|
|
];
|