akaunting / laravel-language

Language switcher package for Laravel
https://akaunting.com
MIT License
219 stars 48 forks source link

Default fallback language? #35

Open boonstoppel opened 2 years ago

boonstoppel commented 2 years ago

Is it possible to set a default fallback language?

My browser language is set to english, but my website only allows languages "de", "fr" and "it". Currently this will set "undefined" as language.

In the config have set 'auto' => true

boonstoppel commented 2 years ago

Also, for the scenario above, this code:

@foreach (language()->allowed() as $code => $name)
        <a href="{{ language()->back($code) }}">{{ $name }}</a>
@endforeach 

will return:

<a href="http://velodach.test/languages/de/back">Deutsch</a>
<a href="http://velodach.test/languages/fr/back">Français</a>
<a href="http://velodach.test/languages/it/back">Italiano</a>
<a href="http://velodach.test/languages/en/back">Unknown</a>

Notice the last line:

<a href="http://velodach.test/languages/en/back">Unknown</a>

boonstoppel commented 2 years ago

ping...

7dir commented 2 years ago

ping...

pong )))