When the system language is set and stored in admin/site, it should always remain at the stored value.
For some time now I have been observing that the set system language changes several times a day. If I set and save the system language it is successfully stored in table config (system - language) and correctly displayed in admin/site. But when I go back to the admin panel some minutes later is has been mysteriously changed to some random language (from en to de, it, en-us, fr, en-gb and so on). The changed value is also stored in the database.
This also affects the language in which admin notification emails are sent.
Difficult. I really don't know how to reproduce it. I have tested a lot of things. Sometimes the setting doesn't change for an hour and sometimes it is changed after 1 minute. Saved the setting, checked the database, read one comment I got a notification for (just an example). And there... Setting changed to some other language. The whole behavior seems to be completely random.
I have the impression that it might be related to some user action. But I have absolutely no clue what could trigger this weird language switch.
I also added language = en to the system section of my local.ini.php - didn't help.
2018.12-dev
db: 1288
pu: 1281
git
7.2.10
10.1.34 MariaDB
The local.ini.php
doesn't override the config
table so this much is off the table. I'll look for all the places where we set the site-wide language.
The local.ini.php doesn't override the config table
I know. But I was desperate. :-)
Found it. We use L10n::pushLang($language)
to temporarily change the current language to format strings in the target language. After we're done, we're supposed to call L10n::popLang()
to restore the previous language.
You guessed it, we didn't do it everywhere we should have.
Most helpful comment
Found it. We use
L10n::pushLang($language)
to temporarily change the current language to format strings in the target language. After we're done, we're supposed to callL10n::popLang()
to restore the previous language.You guessed it, we didn't do it everywhere we should have.