Search code examples
laravellocalizationlumen

Localization in Lumen


Is there any clear documentation on Localization lumen? I searched the whole google/laracast to find some info/documentation about Localization on Lumen but nothing so far.

I came a cross some documentation for lumen but it seems the recent version of lumen doesnt't support Localization . How can I get this done?

Thanks in advance.


Solution

  • In vendor/laravel/lumen-framework/src/helpers.php:363 a trans($id = null, $parameters = [], $domain = 'messages', $locale = null) function is defined, so you can use it in your views

    If you don't request for a certain lang translation, it uses dotenv's APP_LOCALE setting defined in your .env file to get the localized values.

    Using Blade:

    trans('file.key')
    

    Using plain php:

    <?php echo trans('file.key') ?>