mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 10:56:34 +00:00
Only parse JSON once
This commit is contained in:
parent
1a7fa6041e
commit
e9d84d2a69
@ -25,8 +25,16 @@ function getActiveTranslation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let translation = null;
|
let translation = null;
|
||||||
if (window.localStorage.selectedLanguage && JSON.parse(window.localStorage.selectedLanguage)) {
|
let selectedLanguage;
|
||||||
translation = languageGetTranslation(JSON.parse(window.localStorage.selectedLanguage));
|
if (window.localStorage.selectedLanguage) {
|
||||||
|
try {
|
||||||
|
selectedLanguage = JSON.parse(window.localStorage.selectedLanguage);
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore parsing error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selectedLanguage) {
|
||||||
|
translation = languageGetTranslation(selectedLanguage);
|
||||||
if (translation) {
|
if (translation) {
|
||||||
return translation;
|
return translation;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user