Some more Language fix

This commit is contained in:
Roman 2024-05-07 21:57:49 +02:00
parent 40d21cb0ae
commit e081d2a463

@ -139,7 +139,10 @@ class Context {
} else if ($this->user) { } else if ($this->user) {
$this->setLanguage($this->user->language); $this->setLanguage($this->user->language);
} else { } else {
$this->setLanguage(Language::fromHeader()); $language = Language::fromHeader();
if ($language !== null) {
$this->setLanguage($language);
}
} }
} }
@ -147,9 +150,9 @@ class Context {
if ($this->sql) { if ($this->sql) {
$language = Language::findBy(Language::createBuilder($this->sql, true) $language = Language::findBy(Language::createBuilder($this->sql, true)
->where(new CondOr( ->where(new CondOr(
new CondLike(new Column("name"), "%$lang%"), // english new CondLike(new Column("name"), "%$lang%"), // english
new Compare("code", $lang), // de_DE new Compare("code", $lang), // de_DE
new CondLike(new Column("code"), "{$lang}_%") // de -> de_% new CondLike(new Column("code"), "{$lang}_%") // de -> de_%
)) ))
); );
if ($language) { if ($language) {