2020-12-07 14:11:29 +00:00
|
|
|
<?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),
|
2022-11-29 19:53:41 +00:00
|
|
|
get('tell.fallback') /* getenv("DEBUG") ? create(Tell\PrintMissingKey::class) : get('tell.fallback') */
|
2020-12-07 14:11:29 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
'tell.fallback' => function($c) {
|
2022-11-29 19:53:41 +00:00
|
|
|
$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);
|
2020-12-07 14:11:29 +00:00
|
|
|
|
2022-11-29 19:53:41 +00:00
|
|
|
return $i18n;
|
2020-12-07 14:11:29 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
# TODO -- accept folders from Lean Apps
|
|
|
|
Tell\Reader\PhpReader::class => function($c) {
|
2022-11-29 19:53:41 +00:00
|
|
|
return new Tell\Reader\PhpReader($c->get(Lean\Lean::class)->getI18n('php'), false);
|
2020-12-07 14:11:29 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
Tell\Reader\JsonReader::class => function($c) {
|
2022-11-29 19:53:41 +00:00
|
|
|
return new Tell\Reader\JsonReader($c->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
|
2020-12-07 14:11:29 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
LanguageHandler::class => autowire(LanguageHandler::class),
|
|
|
|
];
|