Skip to content

Commit

Permalink
remove redundant calls to translationSelect change
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethbruskiewicz committed Dec 10, 2024
1 parent ed6b84f commit 3c4ba55
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,15 @@ class Toolbar {
}

// reload the context with the new locale

// console.log('reload 1: translationSelect change');
await this.context
.reload(current_template, {
locale: language_update,
})
.then((context) => {
for (const dh in context.dhs) {
if (typeof _dh_data_cache[dh] !== 'undefined') {
const cached_data = _dh_data_cache[dh];
const revised_data = cached_data;
context.dhs[dh].hot.loadData(revised_data);
context.dhs[dh].hot.loadData(_dh_data_cache[dh]);
}
}
const initialDh = this.context.getCurrentDataHarmonizer();
Expand Down Expand Up @@ -397,7 +395,7 @@ class Toolbar {
);
translationSelect
.val(i18next.language === 'en' ? 'default' : in_language)
.trigger('input');
// .trigger('input');
$(document).localize();
}

Expand All @@ -409,6 +407,7 @@ class Toolbar {
}
const locale = in_language;

console.log('reload 2: openfile');
await this.context
.reload(template_path, { locale })
.then((context) => {
Expand Down Expand Up @@ -880,6 +879,7 @@ class Toolbar {

// RELOAD THE INTERFACE BY INTERACTING WITH THE CONTEXT

console.log('reload 3: loadSelectedTemplate');
this.context
.reload(template_path, {
forced_schema: file ? schema : null,
Expand Down Expand Up @@ -924,7 +924,7 @@ class Toolbar {
}
if (currentTranslationVal) {
translationSelect.val(currentTranslationVal);
translationSelect.trigger('input');
// translationSelect.trigger('input');
} else {
// translationSelect.val('en');
}
Expand Down

0 comments on commit 3c4ba55

Please sign in to comment.