Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 493
Riccoh Avatar asked May 30 '26 05:05

Riccoh


1 Answers

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') ?>
like image 146
Marcus Stratu Avatar answered Jun 01 '26 01:06

Marcus Stratu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!