Skip to content

Commit

Permalink
Merge branch 'pr/1389' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Aug 14, 2023
2 parents 27d8ed7 + b57ab18 commit aa323c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 3 additions & 7 deletions js/firstscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,11 @@ enyo.kind({

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

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

l10n.init = async (lang) => {
await i18next.init({
Expand Down Expand Up @@ -33,16 +33,14 @@ define(['i18next.min', 'axios.min'], function (i18next, axios) {
l10n.loadLanguageResource(lang).then((locales) => {
if (locales !== null) {
i18next.addResourceBundle(lang, "translation", locales);
i18next.changeLanguage(lang);
triggerLocalizedEvent();
} else {
l10n.init("en");
}
i18next.changeLanguage(lang);
l10n.initialized = true;
triggerLocalizedEvent();
});
} else {
i18next.changeLanguage(lang);
l10n.initialized = true;
triggerLocalizedEvent();
}
};
Expand Down

0 comments on commit aa323c2

Please sign in to comment.