Fix backend translations load without selection (#979)

This commit is contained in:
Adam Mills 2018-03-10 13:06:25 -05:00 committed by Paulus Schoutsen
parent 97eec435ab
commit 29f9b2d201

View File

@ -122,10 +122,10 @@ class HomeAssistant extends Polymer.Element {
loadBackendTranslations() {
if (!this.hass.language) return;
const language = this.hass.selectedLanguage;
const language = this.hass.selectedLanguage || this.hass.language;
this.hass.callApi('get', `translations/${language}`).then((result) => {
// If we've switched selected languages just ignore this response
if (!this.hass.selectedLanguage === language) return;
if ((this.hass.selectedLanguage || this.hass.language) !== language) return;
this._updateResources(language, result.resources);
});