diff --git a/src/activities/lang/Lang.qml b/src/activities/lang/Lang.qml index 8046d6708..4051fc9f8 100644 --- a/src/activities/lang/Lang.qml +++ b/src/activities/lang/Lang.qml @@ -1,635 +1,636 @@ /* GCompris - lang.qml * * Copyright (C) Siddhesh suthar (Qt Quick port) * * Authors: * Pascal Georges (pascal.georges1@free.fr) (GTK+ version) * Holger Kaelberer (Qt Quick port of imageid) * Siddhesh suthar (Qt Quick port) * Bruno Coudoin (Integration Lang dataset) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.1 import GCompris 1.0 import QtGraphicalEffects 1.0 import "../../core" import "lang.js" as Activity import "quiz.js" as QuizActivity import "spell_it.js" as SpellActivity import "qrc:/gcompris/src/core/core.js" as Core ActivityBase { id: activity onStart: focus = true onStop: {} pageComponent: Image { id: background source: "qrc:/gcompris/src/activities/lang/resource/imageid-bg.svg" fillMode: Image.PreserveAspectCrop sourceSize.width: parent.width property bool horizontalLayout: background.width > background.height property bool keyNavigation: false readonly property string wordsResource: "data2/words/words.rcc" property bool englishFallback: false property bool downloadWordsNeeded: false //system locale by defauls property string locale: "system" signal start signal stop signal voiceError signal voiceDone Component.onCompleted: { dialogActivityConfig.getInitialConfiguration() activity.start.connect(start) activity.stop.connect(stop) } // Add here the QML items you need to access in javascript QtObject { id: items property Item main: activity.main property alias background: background property alias bar: bar property alias bonus: bonus property alias score: score property alias wordImage: wordImage property alias imageFrame: imageFrame property alias wordTextbg: wordTextbg property alias wordText: wordText property alias categoryTextbg: categoryTextbg property alias categoryText: categoryText property alias previousWordButton: previousWordButton property alias parser: parser property alias repeatItem: repeatItem property alias keyboard: keyboard property alias menuModel: menu_screen.menuModel property alias menu_screen: menu_screen property variant goodWord property int goodWordIndex property alias englishFallbackDialog: englishFallbackDialog property alias miniGameLoader: miniGameLoader property alias locale: background.locale property alias progress: background.progress property alias dialogActivityConfig: dialogActivityConfig function checkWordExistence(wordForCheck) { return activity.audioVoices.fileExists(ApplicationInfo.getAudioFilePath(wordForCheck.voice)) } function playWord() { if(!activity.audioVoices.fileExists(ApplicationInfo.getAudioFilePath(goodWord.voice))) { voiceError(); } else { activity.audioVoices.clearQueue() if (!activity.audioVoices.append(ApplicationInfo.getAudioFilePath(goodWord.voice))) voiceError(); } } onGoodWordChanged: playWord() } function handleResourceRegistered(resource) { if (resource == wordsResource) Activity.start(items); } onStart: { Activity.init(items) items.menu_screen.visible = true repeatItem.visible = false activity.audioVoices.error.connect(voiceError) activity.audioVoices.done.connect(voiceDone) // check for words.rcc: if (DownloadManager.isDataRegistered("words")) { // words.rcc is already registered -> start right away Activity.start(items); } else if(DownloadManager.haveLocalResource(wordsResource)) { // words.rcc is there, but not yet registered -> updateResource DownloadManager.resourceRegistered.connect(handleResourceRegistered); DownloadManager.updateResource(wordsResource); } else { // words.rcc has not been downloaded yet -> ask for download downloadWordsNeeded = true } } onStop: { DownloadManager.resourceRegistered.disconnect(handleResourceRegistered); dialogActivityConfig.saveDatainConfiguration() Activity.stop() } Keys.onEscapePressed: { if (Activity.currentMiniGame != -1) { Activity.launchMenuScreen() } } Keys.onLeftPressed: { if( Activity.currentMiniGame == 0 && score.currentSubLevel > 1 ) { - console.log("left key pressed lang and current sub level "+ score.currentSubLevel ) keyNavigation = true Activity.prevSubLevel() } } Keys.onRightPressed: { if( Activity.currentMiniGame == 0) { - console.log("right key pressed lang") keyNavigation = true Activity.nextSubLevel() } } Keys.onSpacePressed: { if( Activity.currentMiniGame == 0) { - console.log("space key pressed lang") keyNavigation = true Activity.nextSubLevel() } } Keys.onEnterPressed: { if( Activity.currentMiniGame == 0) { - console.log("enter key pressed lang") keyNavigation = true Activity.nextSubLevel() } } Keys.onReturnPressed: { if(!menu_screen.visible && Activity.currentMiniGame == 0) { - console.log("return key pressed lang") keyNavigation = true Activity.nextSubLevel() } } JsonParser { id: parser onError: console.error("lang: Error parsing json: " + msg); } Rectangle { id: categoryTextbg x: categoryText.x -4 y: categoryText.y -4 width: imageFrame.width height: categoryText.height +4 color: "#5090ff" border.color: "#000000" border.width: 2 radius: 16 anchors.bottom: imageFrame.top anchors.left: imageFrame.left anchors.bottomMargin: 20 GCText { id: categoryText text: "" fontSize: largeSize font.weight: Font.DemiBold width: parent.width horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "white" wrapMode: Text.WordWrap property string nextCategory function changeCategory(nextCategory_) { nextCategory = nextCategory_ animCategory.start() } SequentialAnimation { id: animCategory PropertyAnimation { target: categoryText property: "opacity" to: 0 duration: 100 } PropertyAction { target: categoryText property: "text" value: qsTr("Category: ")+ categoryText.nextCategory } PropertyAnimation { target: categoryText property: "opacity" to: 1 duration: 100 } } } } Image { id: imageFrame width: background.width * 0.55 height: background.horizontalLayout ? (background.height - bar.height)* 0.7 : (background.height - bar.height) * 0.4 anchors { horizontalCenter: background.horizontalCenter top: background.top topMargin: (background.height - bar.height) * 0.15 } source: "qrc:/gcompris/src/activities/lang/resource/imageid_frame.svg" sourceSize.width: background.horizontalLayout ? parent.width * 0.9 : parent.height * 1.2 z: 11 Image { id: wordImage sourceSize.width: parent.width * 0.6 anchors { centerIn: parent margins: 0.05 + parent.width } property string nextSource function changeSource(nextSource_) { nextSource = nextSource_ animImage.start() } SequentialAnimation { id: animImage PropertyAnimation { target: wordImage property: "opacity" to: 0 duration: 100 } PropertyAction { target: wordImage property: "source" value: wordImage.nextSource } PropertyAnimation { target: wordImage property: "opacity" to: 1 duration: 100 } } MouseArea { anchors.fill: parent onClicked: { if(Activity.currentMiniGame == 0) items.playWord() } } } Image { id: previousWordButton source: "qrc:/gcompris/src/core/resource/bar_previous.svg"; sourceSize.width: 30 * 1.2 * ApplicationInfo.ratio anchors { right: parent.left rightMargin: 30 top: parent.top topMargin: parent.height/2 - previousWordButton.height/2 } MouseArea { id: previousWordButtonArea anchors.fill: parent onClicked: Activity.prevSubLevel() } } Image { id: nextWordButton source: "qrc:/gcompris/src/core/resource/bar_next.svg"; sourceSize.width: 30 * 1.2 * ApplicationInfo.ratio anchors { left: parent.right leftMargin: 30 top: parent.top topMargin: parent.height/2 - previousWordButton.height/2 } MouseArea { id: nextWordButtonArea anchors.fill: parent onClicked: Activity.nextSubLevel(); } } } Rectangle { id: wordTextbg x: wordText.x -4 y: wordText.y -4 width: imageFrame.width height: wordText.height +4 color: "#5090ff" border.color: "#000000" border.width: 2 radius: 16 anchors.top: imageFrame.bottom anchors.left: imageFrame.left anchors.topMargin: 20 GCText { id: wordText text: "" fontSize: largeSize font.weight: Font.DemiBold width: parent.width horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "white" wrapMode: Text.WordWrap property string nextWord function changeText(nextWord_) { nextWord = nextWord_ animWord.start() } SequentialAnimation { id: animWord PropertyAnimation { target: wordText property: "opacity" to: 0 duration: 100 } PropertyAction { target: wordText property: "text" value: wordText.nextWord } PropertyAnimation { target: wordText property: "opacity" to: 1 duration: 100 } } } } MenuScreen{ id: menu_screen } onVoiceDone: repeatItem.visible = true onVoiceError: repeatItem.visible = false BarButton { id: repeatItem source: "qrc:/gcompris/src/core/resource/bar_repeat.svg"; sourceSize.width: 80 * ApplicationInfo.ratio z: menu_screen.visible ? -12 : 12 anchors { top: parent.top left: parent.left margins: 10 * ApplicationInfo.ratio } onClicked: { //items.playWord() if(Activity.currentMiniGame ==0) items.playWord() else Activity.loadedItems.playWord(); } } DialogHelp { id: dialogHelp onClose: home() } Bar { id: bar anchors.bottom: keyboard.top content: BarEnumContent { value: menu_screen.visible ? help | home |config : help | home } onHelpClicked: { displayDialog(dialogHelp) } - // onPreviousLevelClicked: Activity.previousLevel() - // onNextLevelClicked: Activity.nextLevel() - // onHomeClicked: activity.home() onHomeClicked: { Activity.currentSubLesson = 0 Activity.currentMiniGame = -1 if(Activity.savedProgress[Activity.currentLevel] < Activity.currentProgress[Activity.currentLevel]) Activity.savedProgress[Activity.currentLevel] = Activity.currentProgress[Activity.currentLevel] - console.log("clicked on home and saved "+ Activity.savedProgress[Activity.currentLevel]) + console.log("completed level and now progress: "+ Activity.savedProgress[Activity.currentLevel]) menu_screen.menuModel.clear() menu_screen.menuModel.append(Activity.menus) if(menu_screen.visible == false) { menu_screen.visible = true items.imageFrame.visible = false items.score.visible = false level = 0 if (Activity.loadedItems) Activity.loadedItems.visible = false } else { activity.home() } + Activity.sortByFavorites() + } onConfigClicked: { dialogActivityConfig.active = true dialogActivityConfig.setDefaultValues() displayDialog(dialogActivityConfig) } } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } Loader { id: englishFallbackDialog sourceComponent: GCDialog { parent: activity.main message: qsTr("We are sorry, we don't have yet a translation for your language.") + " " + qsTr("GCompris is developed by the KDE community, you can translate GCompris by joining a translation team on %2").arg("http://l10n.kde.org/") + "

" + qsTr("We switched to English for this activity but you can select another language in the configuration dialog.") onClose: background.englishFallback = false } anchors.fill: parent focus: true active: background.englishFallback onStatusChanged: if (status == Loader.Ready) item.start() } Loader { id: downloadWordsDialog sourceComponent: GCDialog { parent: activity.main message: qsTr("The images for this activity are not yet installed.") button1Text: qsTr("Download the images") onClose: background.downloadWordsNeeded = false onButton1Hit: { DownloadManager.resourceRegistered.connect(handleResourceRegistered); DownloadManager.downloadResource(wordsResource) var downloadDialog = Core.showDownloadDialog(activity, {}); } } anchors.fill: parent focus: true active: background.downloadWordsNeeded onStatusChanged: if (status == Loader.Ready) item.start() } Score { id: score anchors.bottom: keyboard.top anchors.bottomMargin: 10 * ApplicationInfo.ratio anchors.right: parent.right anchors.rightMargin: 10 * ApplicationInfo.ratio anchors.top: undefined } Loader { id: miniGameLoader width: parent.width height: parent.height anchors.fill: parent asynchronous: false } VirtualKeyboard { id: keyboard anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter width: parent.width property bool visibleFlag: false visible: ApplicationSettings.isVirtualKeyboard && items.keyboard.visibleFlag && !menu_screen.visible onKeypress: SpellActivity.processKeyPress(text) onError: console.log("VirtualKeyboard error: " + msg); } DialogActivityConfig { id: dialogActivityConfig currentActivity: activity content: Component { Item { property alias localeBox: localeBox height: column.height property alias availableLangs: langs.languages LanguageList { id: langs } Column { id: column spacing: 10 width: parent.width Flow { spacing: 5 width: dialogActivityConfig.width GCComboBox { id: localeBox model: langs.languages background: dialogActivityConfig width: 250 * ApplicationInfo.ratio label: qsTr("Select your locale") } } } } } onLoadData: { if(dataToSave && dataToSave["locale"] && dataToSave["progress"] && dataToSave["storedFavorites"]) { -// if(dataToSave && dataToSave["locale"] && dataToSave["progress"]) { background.locale = dataToSave["locale"]; - Activity.savedProgress = dataToSave["progress"]; + var locale = background.locale + console.log("loading progress "+dataToSave["progress"][locale]) + Activity.newProgress = dataToSave["progress"] + Activity.saveNewProgress(dataToSave["progress"][locale]); var storedFavorites = dataToSave["storedFavorites"]; for(var i = 0;i < storedFavorites.length; i++) { - console.log(i,"storedFavorite ", storedFavorites[i], "type of it ", typeof(storedFavorites[i])); Activity.favorites[i] = ( storedFavorites[i] === "true" || storedFavorites[i] === true); - console.log("here it is ",Activity.favorites[i], "type of it", typeof(Activity.favorites[i])); } } } onSaveData: { var oldLocale = background.locale; var newLocale = oldLocale; if(dialogActivityConfig.loader.item) - newLocale = dialogActivityConfig.configItem.availableLangs[dialogActivityConfig.loader.item.localeBox.currentIndex].locale; + newLocale = dialogActivityConfig.configItem.availableLangs[dialogActivityConfig.loader.item.localeBox.currentIndex].locale; // Remove .UTF-8 if(newLocale.indexOf('.') != -1) { newLocale = newLocale.substring(0, newLocale.indexOf('.')) } - var newProgress = Activity.savedProgress + var newProgress = {}; + newProgress = Activity.newProgress; + newProgress[oldLocale] = Activity.savedProgress + var newStoredFavorites = Activity.favorites - console.log("new progress "+newProgress ) -// dataToSave = {"locale": newLocale, "progress": newProgress} + + console.log("length of progress object ", Object.keys(newProgress).length) + console.log("saving the progress of locale ",oldLocale , " progress " , newProgress[oldLocale]) + dataToSave = {"locale": newLocale, "progress": newProgress, "storedFavorites": newStoredFavorites} background.locale = newLocale; - Activity.savedProgress = newProgress; + Activity.newProgress = newProgress; + Activity.saveNewProgress(newProgress[newLocale]); + console.log("After saving the progress of locale ",newLocale , " progress " , Activity.savedProgress) Activity.favorites = newStoredFavorites; // Restart the activity with new information if(oldLocale !== newLocale) { background.stop(); background.start(); } } function setDefaultValues() { var localeUtf8 = background.locale; if(background.locale != "system") { localeUtf8 += ".UTF-8"; } for(var i = 0 ; i < dialogActivityConfig.configItem.availableLangs.length ; i ++) { if(dialogActivityConfig.configItem.availableLangs[i].locale === localeUtf8) { dialogActivityConfig.loader.item.localeBox.currentIndex = i; break; } } } onClose: home() } } } diff --git a/src/activities/lang/MenuScreen.qml b/src/activities/lang/MenuScreen.qml index 1ca30536c..71c8ec1fe 100644 --- a/src/activities/lang/MenuScreen.qml +++ b/src/activities/lang/MenuScreen.qml @@ -1,247 +1,241 @@ /* GCompris - lang.qml * * Copyright (C) Siddhesh suthar (Qt Quick port) * * Authors: * Pascal Georges (pascal.georges1@free.fr) (GTK+ version) * Holger Kaelberer (Qt Quick port of imageid) * Siddhesh suthar (Qt Quick port) * Bruno Coudoin (Integration Lang dataset) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */import QtQuick 2.1 import GCompris 1.0 import QtGraphicalEffects 1.0 import QtQuick.Controls 1.2 import QtQml.Models 2.1 import "../../core" import "lang.js" as Activity import "quiz.js" as QuizActivity import "spell_it.js" as SpellActivity import "qrc:/gcompris/src/core/core.js" as Core Image { id: menu_screen anchors.fill: parent fillMode: Image.PreserveAspectCrop source: Activity.baseUrl + "imageid-bg.svg" sourceSize.width: parent.width property alias menuModel: menuModel // Filters property bool horizontal: parent.width > parent.height property var currentActiveGrid: menuGrid property bool keyboardMode: false property string favtUrl: "qrc:/gcompris/src/activities/menu/resource/" Keys.onEscapePressed: { if(Activity.currentMiniGame == -1) { home() } else { Activity.launchMenuScreen() } } Keys.onPressed: { if( Activity.currentMiniGame === -1) { items.background.keyNavigation = false event.accepted = true if(event.key === Qt.Key_Space) { currentActiveGrid.currentItem.selectCurrentItem() } if(event.key === Qt.Key_Enter) { currentActiveGrid.currentItem.selectCurrentItem() } if(event.key === Qt.Key_Return) { currentActiveGrid.currentItem.selectCurrentItem() } if(event.key === Qt.Key_Left) { currentActiveGrid.moveCurrentIndexLeft() } if(event.key === Qt.Key_Right) { currentActiveGrid.moveCurrentIndexRight() } if(event.key === Qt.Key_Up) { currentActiveGrid.moveCurrentIndexUp() } if(event.key === Qt.Key_Down) { currentActiveGrid.moveCurrentIndexDown() } } } Keys.onReleased: { keyboardMode = true event.accepted = false } // Activities property int iconWidth: 190 * ApplicationInfo.ratio property int iconHeight: 190 * ApplicationInfo.ratio property int levelCellWidth: horizontal ? background.width / Math.floor(background.width / iconWidth ): background.width / Math.floor(background.width / iconWidth) property int levelCellHeight: iconHeight * 1.5 ListModel { id: menuModel } GridView { id: menuGrid layer.enabled: true anchors { top: parent.top fill: parent // margins: 4 } width: background.width cellWidth: levelCellWidth cellHeight: levelCellHeight clip: true model: menuModel keyNavigationWraps: true property int spacing: 10 delegate: Item { id: delegateItem width: levelCellWidth - menuGrid.spacing height: levelCellHeight - menuGrid.spacing Rectangle { id: activityBackground width: levelCellWidth - menuGrid.spacing height: levelCellHeight - menuGrid.spacing anchors.horizontalCenter: parent.horizontalCenter color: "white" opacity: 0.5 } Image { id: containerImage source: "qrc:/gcompris/data/"+ image; anchors.top: activityBackground.top anchors.horizontalCenter: parent.horizontalCenter sourceSize.height: iconHeight anchors.margins: 5 GCText { id: title anchors.top: parent.bottom anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter width: activityBackground.width fontSizeMode: Text.Fit minimumPointSize: 7 fontSize: regularSize elide: Text.ElideRight maximumLineCount: 2 wrapMode: Text.WordWrap text: name } // TODO : progress bar ProgressBar { id: progressLang anchors.top: title.bottom anchors.topMargin: ApplicationInfo.ratio * 4 anchors.horizontalCenter: parent.horizontalCenter width: activityBackground.width maximumValue: wordCount minimumValue: 0 value: Activity.savedProgress[index] orientation: Qt.Horizontal } } ParticleSystemStarLoader { id: particles anchors.fill: activityBackground } MouseArea { anchors.fill: activityBackground onClicked: selectCurrentItem() } function selectCurrentItem() { particles.burst(50) Activity.initLevel(index) } property bool favoriteIndicator: Activity.favorites[index] Image { id: favtImage source: menu_screen.favtUrl +( favoriteIndicator ? "all.svg" : "all_disabled.svg"); anchors { top: parent.top right: parent.right rightMargin: 4 * ApplicationInfo.ratio } sourceSize.width: iconWidth * 0.25 visible: ApplicationSettings.sectionVisible MouseArea { anchors.fill: parent onClicked: { - console.log("once and for all ", typeof(Activity.favorites[index]), "value", Activity.favorites[index]) favoriteIndicator = !favoriteIndicator Activity.favorites[index] = favoriteIndicator } } } } //delegate close highlight: Rectangle { width: levelCellWidth - menuGrid.spacing height: levelCellHeight - menuGrid.spacing color: "#AA41AAC4" border.width: 3 border.color: "black" visible: menu_screen.keyboardMode Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } } Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } } } } // grid view close Rectangle{ id: menusMask visible: false anchors.fill: menuGrid gradient: Gradient { GradientStop { position: 0.0; color: "#FFFFFFFF" } GradientStop { position: 0.92; color: "#FFFFFFFF" } GradientStop { position: 0.96; color: "#00FFFFFF"} } } - DelegateModel { - - } - - layer.effect: OpacityMask { id: activitiesOpacity source: menuGrid maskSource: menusMask anchors.fill: menuGrid } } diff --git a/src/activities/lang/lang.js b/src/activities/lang/lang.js index 2408b0803..79c603cb5 100644 --- a/src/activities/lang/lang.js +++ b/src/activities/lang/lang.js @@ -1,337 +1,353 @@ /* GCompris - lang.qml * * Copyright (C) Siddhesh suthar (Qt Quick port) * * Authors: * Pascal Georges (pascal.georges1@free.fr) (GTK+ version) * Holger Kaelberer (Qt Quick port of imageid) * Siddhesh suthar (Qt Quick port) * Bruno Coudoin (Integration Lang dataset) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */.pragma library .import QtQuick 2.0 as Quick .import GCompris 1.0 as GCompris .import "qrc:/gcompris/src/core/core.js" as Core .import "qrc:/gcompris/src/activities/lang/lang_api.js" as Lang .import "qrc:/gcompris/src/activities/lang/quiz.js" as QuizActivity .import "qrc:/gcompris/src/activities/lang/spell_it.js" as SpellActivity var currentLevel = 0; var currentSubLevel = 0; var level = null; var maxLevel; var maxSubLevel; var items; var baseUrl = "qrc:/gcompris/src/activities/lang/resource/"; var dataset = null; var lessons var maxWordInLesson = 12 var wordList var subLevelsLeft var menus = [] var currentProgress = [] var savedProgress = [] var favorites= [] var subWordList var currentSubLesson var maxSubLesson +var currentLocale // miniGames is list of miniGames // first element is Activity name, // second element is mode of miniGame // third element is the qml to load var miniGames = [["QuizActivity", 1,"Quiz.qml"], ["QuizActivity", 2,"Quiz.qml"], ["QuizActivity", 3,"Quiz.qml"], ["SpellActivity", 1,"SpellIt.qml"]]; var currentMiniGame var loadedItems +var newProgress = {} function init(items_) { items = items_ maxLevel = 0 maxSubLevel = 0 currentLevel = 0 currentSubLevel = 0 currentSubLesson = 0 currentMiniGame = -1 } function start() { currentLevel = 0; currentSubLevel = 0; var locale = items.locale == "system" ? "$LOCALE" : items.locale dataset = Lang.load(items.parser, baseUrl, "words.json", "content-"+ locale +".json") // If dataset is empty, we try to load from short locale and if not present again, we switch to default one var localeUnderscoreIndex = locale.indexOf('_') if(!dataset) { var localeShort; // We will first look again for locale xx (without _XX if exist) if(localeUnderscoreIndex > 0) { localeShort = locale.substring(0, localeUnderscoreIndex) } else { localeShort = locale; } dataset = Lang.load(items.parser, baseUrl, "words.json", "content-"+localeShort+ ".json") } //If still dataset is empty then fallback to english if(!dataset) { // English fallback items.background.englishFallback = true dataset = Lang.load(items.parser, baseUrl, "words.json", "content-en.json") } else { items.background.englishFallback = false } lessons = Lang.getAllLessons(dataset) maxLevel = lessons.length menus = Lang.getMenuModel(dataset, items) items.menuModel.clear() for (var j =0; j 0)) currentProgress[j] = 0 } - for (var k =0; k0)) { + currentLocale = items.locale + //for first time filling up the progress + if(!items.dialogActivityConfig.dataToSave["progress"]) { + console.log("progress saved does not exist "+currentLocale) + savedProgress = [] + for(var k =0; k