Skip to content

Commit

Permalink
Wait localization to launch first screen tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Aug 12, 2023
1 parent 2c7c727 commit 27d8ed7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 5 additions & 1 deletion js/firstscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ enyo.kind({

// At first launch, display tutorial
var that = this;
window.setTimeout(function() {
var interval = window.setInterval(function() {
if (that.history.length == 0) {
if (!l10n.initialized) {
return;
}
that.startTutorial();
}
window.clearInterval(interval);
}, constant.timerBeforeTutorial);
},

Expand Down
7 changes: 3 additions & 4 deletions lib/l10n.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
define(['i18next.min', 'axios.min'], function (i18next, axios) {
const l10n = {language: {direction: "ltr"}};
let initialized = false;
const l10n = {language: {direction: "ltr"}, initialized: false};

l10n.init = async (lang) => {
await i18next.init({
Expand Down Expand Up @@ -38,12 +37,12 @@ define(['i18next.min', 'axios.min'], function (i18next, axios) {
l10n.init("en");
}
i18next.changeLanguage(lang);
initialized = true;
l10n.initialized = true;
triggerLocalizedEvent();
});
} else {
i18next.changeLanguage(lang);
initialized = true;
l10n.initialized = true;
triggerLocalizedEvent();
}
};
Expand Down

0 comments on commit 27d8ed7

Please sign in to comment.