adminarchitect / core

AdminArchitect - Active Admin for Laravel
http://adminarchitect.com
MIT License
211 stars 66 forks source link

The main language of the site when using the localizer #9

Closed YulKard closed 6 years ago

YulKard commented 6 years ago

Good afternoon! We set up the multilanguage on the site. Installed, as indicated in the documentation, terranet / localizer & terranet / translatable. The main language is Ukrainian, the rest is Russian and English (site.ru and site.ru/en). In config / app.php 'locale' => 'uk', 'fallback_locale' => 'ru' As a result, the website does not work out the main language, it constantly interrupts the Russian. If the Russian language is disabled in the languages ​​table - everything works. It turns out that with the installed admin function setLocale works 2 times, the first time it sets the language correctly on uk, and then interrupts it in Russian. This problem is observed only with the Russian language. If you install Russian as the main one, then everything also works correctly. In the vendor \ terranet \ localizer \ src \ Terranet \ Localizer \ Localizer.php file, the language http://joxi.ru/5mdMjMjukdvlO2 is installed. In the find () function, $ this-> resolver-> resolve () returns permanently ru_RU. Tell me, what can be the error? Maybe I misunderstood something. Thank you in advance.

endihunter commented 6 years ago

localizer supports 3 different locale resolvers, default is RequestResolver which tries to detect your locale by reading the HTTP_ACCEPT_LANGUAGE header. to disable this behavior, just set the 'request.header' => '' in the config/localizer.php

YulKard commented 6 years ago

If you leave 'request.header' empty, then the language is set with config / app.fallback_locale? If you install app.fallback_locale => 'ru', and 'locale' => 'uk', then the localizer sets the Russian language. That is, then it turns out that the admin and frontend should be in one main language? That is, set fallback_locale => 'uk' and 'locale' => 'uk'?