- WIP on cleaning of definitions files

This commit is contained in:
Dave Mc Nicoll committed 2024-06-07 00:01:43 +00:00
1 parent 63fde92b68
commit d9f9c053c3
8 files changed
+55 -29

No files matched your search

+22 -14
View File
@@ -1,29 +1,37 @@
<?php
use function DI\autowire, DI\create, DI\get;
use Tell\I18n;
use Psr\Container\ContainerInterface;
use Notes\Tell\LanguageHandler;
return [
Tell\I18n::class => create( Tell\I18n::class ) ->constructor(
get(Tell\Reader\JsonReader::class),
get(Tell\Reader\PhpReader::class),
get('tell.fallback') /* getenv("DEBUG") ? create(Tell\PrintMissingKey::class) : get('tell.fallback') */
),
use function DI\autowire, DI\create, DI\get, DI\add;
'tell.fallback' => function($c) {
$i18n = new Tell\I18n( $c->get(Tell\Reader\JsonReader::class), $c->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
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($c) {
return new Tell\Reader\PhpReader($c->get(Lean\Lean::class)->getI18n('php'), false);
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($c) {
return new Tell\Reader\JsonReader($c->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
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,
]),
];