How do I fetch name of locale (language) not just a locale string, but rather the name of that language in LARAVEL?
{{ app()->getLocale() }}
How do I fetch name of locale (language) not just a locale string, but rather the name of that language in LARAVEL?
{{ app()->getLocale() }}
I resolved this by adding an entry to a translation file using Laravel Localization.
https://laravel.com/docs/5.7/localization
In
AppServiceProvider@boot
:I then have an entry for each language in dir
resources/lang/LOCALE_ISO_3 (ENG/SPA/ITA...)/language.php
To then get a list of available languages:
Results in:
To get current active language:
Gives you:
Laravel doesn't have this information. You need to add it manually by creating table or config with locales and their languages names.