L18n: Check for language availablitiy while language switching

Fixed #280
This commit is contained in:
veselcraft 2021-11-20 12:48:19 +03:00
parent d72fa1aac9
commit af45a85ff7
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -109,7 +109,10 @@ function tr(string $stringId, ...$variables): string
function setLanguage($lg): void function setLanguage($lg): void
{ {
if (isLanguageAvailable($lg))
Session::i()->set("lang", $lg); Session::i()->set("lang", $lg);
else
trigger_error("The language '$lg' is not available", E_USER_NOTICE);
} }
function getLanguages(): array function getLanguages(): array