mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 18:06:36 +00:00
Fix race condition setting current language (#996)
This commit is contained in:
parent
e0ca88b3ad
commit
b80c52dab2
@ -173,8 +173,8 @@ class HomeAssistant extends Polymer.Element {
|
||||
themes: null,
|
||||
panelUrl: this.panelUrl,
|
||||
|
||||
// If language and resources are already loaded, don't discard them
|
||||
language: (this.hass && this.hass.language) || null,
|
||||
language: window.getActiveTranslation(),
|
||||
// If resources are already loaded, don't discard them
|
||||
resources: (this.hass && this.hass.resources) || null,
|
||||
|
||||
translationMetadata: window.translationMetadata,
|
||||
|
@ -1,7 +1,7 @@
|
||||
<link rel='import' href='../../build-translations/translationMetadata.html' />
|
||||
|
||||
<script>
|
||||
function getActiveTranslation() {
|
||||
window.getActiveTranslation = function () {
|
||||
// Perform case-insenstive comparison since browser isn't required to
|
||||
// report languages with specific cases.
|
||||
const lookup = {};
|
||||
@ -59,7 +59,7 @@ function getActiveTranslation() {
|
||||
|
||||
// Final fallback
|
||||
return 'en';
|
||||
}
|
||||
};
|
||||
|
||||
// Store loaded translations in memory so translations are available immediately
|
||||
// when DOM is created in Polymer. Even a cache lookup creates noticeable latency.
|
||||
|
Loading…
x
Reference in New Issue
Block a user