30 lines
1004 B
PHP
30 lines
1004 B
PHP
<?php
|
|
|
|
use function DI\autowire, DI\create, DI\get;
|
|
|
|
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') */
|
|
),
|
|
|
|
'tell.fallback' => function($c) {
|
|
$i18n = new Tell\I18n( $c->get(Tell\Reader\JsonReader::class), $c->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\JsonReader::class => function($c) {
|
|
return new Tell\Reader\JsonReader($c->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
|
|
},
|
|
];
|