mirror of
https://github.com/unraid/api.git
synced 2026-02-17 05:28:32 -06:00
refactor: translations class usage
This commit is contained in:
@@ -7,7 +7,7 @@ $serverState = new ServerState();
|
||||
$wCTranslations = new WebComponentTranslations();
|
||||
?>
|
||||
<script>
|
||||
window.LOCALE_DATA = '<?= rawurlencode(json_encode($wCTranslations->getTranslations(), JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE)) ?>';
|
||||
window.LOCALE_DATA = '<?= $wCTranslations->getTranslationsJson(true) ?>';
|
||||
/**
|
||||
* So we're not needing to modify DefaultLayout with an additional include, we'll add the Modals web component to the bottom of the body.
|
||||
*/
|
||||
|
||||
@@ -374,4 +374,16 @@ class WebComponentTranslations
|
||||
{
|
||||
return $this->translations ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $urlEncode {bool}
|
||||
* @return string
|
||||
*/
|
||||
public function getTranslationsJson($urlEncode = false)
|
||||
{
|
||||
if ($urlEncode) {
|
||||
return rawurlencode(json_encode($this->getTranslations(), JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
return json_encode($this->getTranslations(), JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user