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