Merge pull request #4017 from christianbeeznest/ofaj19044-coursintro3

Tool intro: Fix translate html by user language - refs BT#19044
pull/4020/head
Julio Montoya 3 years ago committed by GitHub
commit 1ad423f718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      assets/js/document.js
  2. 10
      assets/js/translatehtml.js
  3. 5
      assets/js/vendor.js
  4. 3
      assets/vue/views/course/Home.vue

@ -1,3 +1,6 @@
/** This JS will be included when loading an HTML in the Document tool */
require('./translatehtml.js');
import translateHtml from './translatehtml.js';
document.addEventListener('DOMContentLoaded', function () {
translateHtml();
});

@ -1,6 +1,6 @@
/* For licensing terms, see /license.txt */
document.addEventListener('DOMContentLoaded', function () {
export default function translateHtml() {
if (
window.user && window.user.locale &&
window.config &&
@ -20,9 +20,10 @@ document.addEventListener('DOMContentLoaded', function () {
userLang.style.display = 'block';
});
}
} else {
}
// it checks content from old version
const langs = document.querySelectorAll('span[lang]');
const langs = document.querySelectorAll('span[lang]:not(.mce-translatehtml)');
if (langs.length > 0) {
// it hides all contents with lang
langs.forEach(function (el) {
@ -48,5 +49,4 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
}
}
});
}

@ -21,4 +21,7 @@ global.textcomplete = textcomplete;
require('chart.js');
require('./annotation.js');
require('./translatehtml.js');
import translateHtml from './translatehtml.js';
document.addEventListener('DOMContentLoaded', function () {
translateHtml();
});

@ -176,6 +176,7 @@ import axios from "axios";
import {ENTRYPOINT} from '../../config/entrypoint';
import {computed, onMounted, reactive, toRefs} from 'vue'
import {mapGetters, useStore} from "vuex";
import translateHtml from '../../../js/translatehtml.js';
export default {
name: 'Home',
@ -235,6 +236,7 @@ export default {
if (!isEmpty(response)) {
// first item
state.intro = response[0];
translateHtml();
}
});
@ -250,6 +252,7 @@ export default {
if (!isEmpty(response)) {
state.createInSession = false;
state.intro = response[0];
translateHtml();
}
});
}

Loading…
Cancel
Save