Internal: Fix translate_html issues - refs BT#21540

pull/5409/head
christianbeeznst 7 months ago
parent 0986bbfd4f
commit be55c477a8
  1. 1
      assets/css/scorm.scss
  2. 14
      assets/js/translatehtml.js
  3. 8
      assets/vue/views/course/CourseHome.vue

@ -444,6 +444,7 @@ body {
.icon-toolbar .fa:hover, .icon-toolbar .fa:hover,
.icon-toolbar .mdi:hover { .icon-toolbar .mdi:hover {
color: #666666;
} }
.expand .fa, .expand .fa,

@ -1,20 +1,13 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
import { usePlatformConfig } from "../vue/store/platformConfig"
function normalizeLocale(locale) { function normalizeLocale(locale) {
return locale.split('_')[0] return locale.split('_')[0]
} }
export default async function translateHtml() { export default function translateHtml() {
try {
const platformConfigStore = usePlatformConfig()
await platformConfigStore.initialize()
if ( if (
window.user && window.user &&
window.user.locale && window.user.locale
"true" === platformConfigStore.getSetting("editor.translate_html")
) { ) {
var isoCode = normalizeLocale(window.user.locale) var isoCode = normalizeLocale(window.user.locale)
const translateElement = document.querySelector(".mce-translatehtml") const translateElement = document.querySelector(".mce-translatehtml")
@ -50,7 +43,4 @@ export default async function translateHtml() {
} }
} }
} }
} catch (error) {
console.error("Error in translateHtml:", error)
}
} }

@ -382,9 +382,11 @@ const isAllowedToEdit = ref(false)
onMounted(async () => { onMounted(async () => {
isAllowedToEdit.value = await checkIsAllowedToEdit() isAllowedToEdit.value = await checkIsAllowedToEdit()
setTimeout(() => { if ("true" === platformConfigStore.getSetting("editor.translate_html")) {
translateHtml() setTimeout(() => {
}, 1000) translateHtml()
}, 1000)
}
}) })
const onStudentViewChanged = async () => { const onStudentViewChanged = async () => {

Loading…
Cancel
Save