Lemon-Framework / Lemon

🍋 A php microframework
https://lemon-framework.github.io/docs/
GNU General Public License v3.0
24 stars 8 forks source link

Adds Translating #100

Closed tenmajkl closed 1 year ago

tenmajkl commented 1 year ago

This PR adds new Translating component. This component allows building multi-language websites more easily. You simply define translation files like this:

// translations/en.php
return [
    'title' => 'Welcome to the Lemon Framework'
];

// translations/cs.php
return [
    'title' => 'Vitejte v citronove ramopraci'
];

Locale can be changed via \Lemon\Translator::locate().

And texts can be accessed via \Lemon\Translator::text() or { text } juice directive.

It also adds \Lemon\Translating\Middlewares\TranslationLocalizer which can be used to automatically set locale from sesion.