From af45a85ff79ddc68e8ba10431e3ca1a0ded182af Mon Sep 17 00:00:00 2001 From: veselcraft Date: Sat, 20 Nov 2021 12:48:19 +0300 Subject: [PATCH] L18n: Check for language availablitiy while language switching Fixed #280 --- bootstrap.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bootstrap.php b/bootstrap.php index ebe71e45..ca6fe6a8 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -109,7 +109,10 @@ function tr(string $stringId, ...$variables): string function setLanguage($lg): void { - Session::i()->set("lang", $lg); + if (isLanguageAvailable($lg)) + Session::i()->set("lang", $lg); + else + trigger_error("The language '$lg' is not available", E_USER_NOTICE); } function getLanguages(): array