Minor improvements
This commit is contained in:
		| @@ -93,7 +93,7 @@ class Auth { | ||||
|             try { | ||||
|                 $client = TeamSpeakUtils::i()->getTSNodeServer()->clientGetByDbid($cldbid); | ||||
|                 $code = (string) Utils::getSecureRandomInt(100000, 999999); | ||||
|                 $msg = LanguageUtils::tl("LOGIN_CONFIRMATION_CODE", $code); | ||||
|                 $msg = __get("LOGIN_CONFIRMATION_CODE", $code); | ||||
|  | ||||
|                 if ($poke) { | ||||
|                     $client->poke(mb_substr($msg, 0, 100)); // Max 100 characters for pokes | ||||
|   | ||||
| @@ -19,17 +19,6 @@ class LanguageUtils { | ||||
|     private $cache; | ||||
|     private $languages; | ||||
|  | ||||
|     /** | ||||
|      * Short function for translate | ||||
|      * @param string $identifier | ||||
|      * @param array|string $args | ||||
|      * @return string | ||||
|      * @throws \Exception | ||||
|      */ | ||||
|     public static function tl(string $identifier, $args = []): string { | ||||
|         return self::i()->translate($identifier, $args); | ||||
|     } | ||||
|  | ||||
|     private function __construct() { | ||||
|         $this->cache = new PhpFileCache(__CACHE_DIR, "translations"); | ||||
|  | ||||
|   | ||||
| @@ -76,7 +76,11 @@ if(!isset($_SESSION["userlanguageid"])) { | ||||
|         try { | ||||
|             return LanguageUtils::i()->translate($identifier, $args); | ||||
|         } catch (\Exception $e) { | ||||
|             return "(unknown translation for " . Utils::escape($identifier) . ")"; | ||||
|             if ($nullOnError) { | ||||
|                 return null; | ||||
|             } else { | ||||
|                 return "(unknown translation for " . Utils::escape($identifier) . ")"; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -191,8 +191,8 @@ $navActiveIndex = isset($navActiveIndex) ? (int) $navActiveIndex : 0; | ||||
| <!-- Moment.js 2.22.2 --> | ||||
| {$tplutils::includeScript("{cdnjs}/moment.js/2.24.0/moment.min.js", "sha256-4iQZ6BVL4qNKlQ27TExEhBN1HFPvAvAMbFavKKosSWQ=")} | ||||
|  | ||||
| {var momentjslang = Wruczek\TSWebsite\Utils\Language\LanguageUtils::tl("MOMENTJS_LANG")} | ||||
| {if $momentjslang !== "en-us"} | ||||
| {var momentjslang = __get("MOMENTJS_LANG", [], true)} | ||||
| {if $momentjslang !== null && $momentjslang !== "en-us"} | ||||
|     {$tplutils::includeScript("{cdnjs}/moment.js/2.24.0/locale/$momentjslang.js")} | ||||
|     <script> | ||||
|         moment.locale({$momentjslang} || navigator.languages || navigator.language) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user