improve i18n

This commit is contained in:
mercury
2023-04-20 23:16:49 +04:00
parent 3463044471
commit aad0b4597a
2 changed files with 184 additions and 100 deletions
+2 -6
View File
@@ -112,11 +112,7 @@ class Bot
case preg_match('~^/menu (?P<type>addpeer) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>wg) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>client) (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>pac)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>adguard)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>config)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>ss)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>lang)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>pac|adguard|config|ss|lang)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>subzoneslist|reverselist|includelist|excludelist) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
$this->menu(type: $m['type'] ?? false, arg: $m['arg'] ?? false);
break;
@@ -1749,7 +1745,7 @@ DNS-over-HTTPS with IP:
public function i18n(string $menu): string
{
return $this->i18n[$this->language][$menu] ?: 'no translate';
return $this->i18n[$menu][$this->language] ?: 'no translate';
}
public function menu($type = false, $arg = false, $return = false)