mirror of
https://github.com/sensebox/blockly-app
synced 2025-02-22 06:23:59 +01:00
fix language intialization for non-supported languages
This commit is contained in:
parent
930e7fa408
commit
30437d24fe
1 changed files with 10 additions and 2 deletions
|
@ -26,7 +26,7 @@ export class openSenseApp {
|
||||||
title: 'MENU.DOCS',
|
title: 'MENU.DOCS',
|
||||||
icon: 'book',
|
icon: 'book',
|
||||||
callback: () => {
|
callback: () => {
|
||||||
window.open('https://sensebox.github.io/books-v2/blockly/' + this.translate.currentLang)
|
window.open(`https://sensebox.github.io/books-v2/blockly/${this.translate.currentLang}/`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,8 @@ export class openSenseApp {
|
||||||
splashScreen: SplashScreen,
|
splashScreen: SplashScreen,
|
||||||
) {
|
) {
|
||||||
this.translate.setDefaultLang(DEFAULT_LANG)
|
this.translate.setDefaultLang(DEFAULT_LANG)
|
||||||
this.translate.use(this.translate.getBrowserLang()) // @TODO: check if this works on all platforms!
|
this.translate.use(this.getPreferredLanguage())
|
||||||
|
|
||||||
platform.ready()
|
platform.ready()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if ((<any>window).cordova) {
|
if ((<any>window).cordova) {
|
||||||
|
@ -66,8 +67,15 @@ export class openSenseApp {
|
||||||
|
|
||||||
// Reset the content nav to have just this page
|
// Reset the content nav to have just this page
|
||||||
// we wouldn't want the back button to show in this scenario
|
// we wouldn't want the back button to show in this scenario
|
||||||
|
// this.nav.setRoot(page.component);
|
||||||
this.nav.setRoot(page.component);
|
this.nav.setRoot(page.component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getPreferredLanguage () {
|
||||||
|
const langsAvailable = this.translate.getLangs()
|
||||||
|
const lang = this.translate.getBrowserLang()
|
||||||
|
return langsAvailable.indexOf(lang) === -1 ? DEFAULT_LANG : lang
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AppPage {
|
interface AppPage {
|
||||||
|
|
Loading…
Add table
Reference in a new issue