Minor improvements
This commit is contained in:
parent
b736b13286
commit
753c6c7688
|
@ -93,7 +93,7 @@ class Auth {
|
||||||
try {
|
try {
|
||||||
$client = TeamSpeakUtils::i()->getTSNodeServer()->clientGetByDbid($cldbid);
|
$client = TeamSpeakUtils::i()->getTSNodeServer()->clientGetByDbid($cldbid);
|
||||||
$code = (string) Utils::getSecureRandomInt(100000, 999999);
|
$code = (string) Utils::getSecureRandomInt(100000, 999999);
|
||||||
$msg = LanguageUtils::tl("LOGIN_CONFIRMATION_CODE", $code);
|
$msg = __get("LOGIN_CONFIRMATION_CODE", $code);
|
||||||
|
|
||||||
if ($poke) {
|
if ($poke) {
|
||||||
$client->poke(mb_substr($msg, 0, 100)); // Max 100 characters for pokes
|
$client->poke(mb_substr($msg, 0, 100)); // Max 100 characters for pokes
|
||||||
|
|
|
@ -19,17 +19,6 @@ class LanguageUtils {
|
||||||
private $cache;
|
private $cache;
|
||||||
private $languages;
|
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() {
|
private function __construct() {
|
||||||
$this->cache = new PhpFileCache(__CACHE_DIR, "translations");
|
$this->cache = new PhpFileCache(__CACHE_DIR, "translations");
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,11 @@ if(!isset($_SESSION["userlanguageid"])) {
|
||||||
try {
|
try {
|
||||||
return LanguageUtils::i()->translate($identifier, $args);
|
return LanguageUtils::i()->translate($identifier, $args);
|
||||||
} catch (\Exception $e) {
|
} 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 -->
|
<!-- Moment.js 2.22.2 -->
|
||||||
{$tplutils::includeScript("{cdnjs}/moment.js/2.24.0/moment.min.js", "sha256-4iQZ6BVL4qNKlQ27TExEhBN1HFPvAvAMbFavKKosSWQ=")}
|
{$tplutils::includeScript("{cdnjs}/moment.js/2.24.0/moment.min.js", "sha256-4iQZ6BVL4qNKlQ27TExEhBN1HFPvAvAMbFavKKosSWQ=")}
|
||||||
|
|
||||||
{var momentjslang = Wruczek\TSWebsite\Utils\Language\LanguageUtils::tl("MOMENTJS_LANG")}
|
{var momentjslang = __get("MOMENTJS_LANG", [], true)}
|
||||||
{if $momentjslang !== "en-us"}
|
{if $momentjslang !== null && $momentjslang !== "en-us"}
|
||||||
{$tplutils::includeScript("{cdnjs}/moment.js/2.24.0/locale/$momentjslang.js")}
|
{$tplutils::includeScript("{cdnjs}/moment.js/2.24.0/locale/$momentjslang.js")}
|
||||||
<script>
|
<script>
|
||||||
moment.locale({$momentjslang} || navigator.languages || navigator.language)
|
moment.locale({$momentjslang} || navigator.languages || navigator.language)
|
||||||
|
|
Loading…
Reference in New Issue