constructor() { super(); this.state = { menuIsOpen: false, status: {state: 'fetching', msg: undefined}, title: "Welcome to our digital Vernisage", intro: "Content is loading", baseurl: null, entries: [], navigation: { pushPage: this.pushPage.bind(this), popPage: this.popPage.bind(this), openMenu: this.open.bind(this), displayError: this.displayError.bind(this), }, currentPage: "overview", language: { fallback: 'de', possible: ['de', 'en'], onChange: this.onLanguageChange.bind(this) }, refresh: this.loadData.bind(this) }; if(typeof(Storage) !== "undefined") { if(localStorage.language) { this.state.language.inUse = localStorage.language; console.log("Use stored language: " + localStorage.language); return; } } if(!this.state.language.inUse && typeof(navigator.language) !== "undefined") { this.state.language.inUse = navigator.language.split("-")[0].split("_")[0]; console.log("Use navigator.language"); console.log("Language is: " + this.state.language.inUse); } else { this.state.language.inUse = this.state.language.fallback; console.log("Use fallback"); console.log("Language is: " + this.state.language.inUse); } if (ons.platform.isIPhoneX()) { // Utility function // Add empty attribute to the <html> element document.documentElement.setAttribute('onsflag-iphonex-landscape', ''); document.documentElement.setAttribute('onsflag-iphonex-portrait', ''); } }