Skip to content
Snippets Groups Projects

update: test to translate confirm message

Merged Benoit Alessandroni requested to merge orbit-remove-contact-translate-confirm#17 into master
2 files
+ 2
35
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 1
34
@@ -76,34 +76,6 @@ class JsI18n {
@@ -76,34 +76,6 @@ class JsI18n {
return this.mergeDeep(target, ...sources);
return this.mergeDeep(target, ...sources);
}
}
/*
Translates tag contents and
attributes depending on the
value of key.
*/
translateDialog(node) {
if (node.attributes['confirmation-message']) {
let translation = this.t(node.attributes['confirmation-message'].value);
if (translation) {
node.attributes['confirmation-message'].value = translation;
}
}
if (node.attributes['confirmation-submit-text']) {
let translation = this.t(node.attributes['confirmation-submit-text'].value);
if (translation) {
node.attributes['confirmation-submit-text'].value = translation;
}
}
if (node.attributes['confirmation-cancel-text']) {
let translation = this.t(node.attributes['confirmation-cancel-text'].value);
if (translation) {
node.attributes['confirmation-cancel-text'].value = translation;
}
}
}
/*
/*
Translates tag contents and
Translates tag contents and
attributes depending on the
attributes depending on the
@@ -186,11 +158,6 @@ class JsI18n {
@@ -186,11 +158,6 @@ class JsI18n {
var key = node.attributes["data-trans"];
var key = node.attributes["data-trans"];
if (key != null) {
if (key != null) {
this.translateTag(node, key.nodeValue);
this.translateTag(node, key.nodeValue);
} else {
key = node.attributes["confirmation-message"];
if (key) {
this.translateDialog(node);
}
}
}
}
}
@@ -299,7 +266,7 @@ document.addEventListener("DOMContentLoaded", () => {
@@ -299,7 +266,7 @@ document.addEventListener("DOMContentLoaded", () => {
let timer, timer2;
let timer, timer2;
(new MutationObserver((mutations) => {
(new MutationObserver((mutations) => {
mutations.forEach(mutation => {
mutations.forEach(mutation => {
if (mutation.target.attributes["data-trans"] != null || mutation.target.attributes["confirmation-message"] != null) {
if (mutation.target.attributes["data-trans"] != null) {
// Render the target of the mutation instantly
// Render the target of the mutation instantly
window.orbit.intl.processNode(mutation.target);
window.orbit.intl.processNode(mutation.target);
// Then wait one arbitrary second to re-render the whole document in case a widget re-rendered
// Then wait one arbitrary second to re-render the whole document in case a widget re-rendered
Loading