Add Internationalization

- Add Utils/L10n class
- Add translator functions to PHP Renderer
- Refactor web controllers to prevent duplicated code
- Add locale middleware
- Add translation file loading
- Add i18n settings
This commit is contained in:
Hypolite Petovan 2018-11-15 23:59:00 -05:00
commit 5b7bb030de
21 changed files with 537 additions and 245 deletions

View file

@ -5,9 +5,9 @@ use Interop\Container\ContainerInterface;
// DIC configuration
// l10n
$container['l10n'] = function (ContainerInterface $c): Friendica\Directory\Content\L10n {
$settings = $c->get('settings')['l10n'];
return new Friendica\Directory\Content\L10n($settings['language'] ?: 'en', $settings['lang_path'] ?: '');
$container['l10n'] = function (ContainerInterface $c): Gettext\TranslatorInterface {
$translator = new Gettext\Translator();
return $translator;
};
// simple cache