From be55c477a8e11a65f30f3675d11b698080194464 Mon Sep 17 00:00:00 2001 From: christianbeeznst Date: Sat, 20 Apr 2024 19:24:00 -0500 Subject: [PATCH] Internal: Fix translate_html issues - refs BT#21540 --- assets/css/scorm.scss | 1 + assets/js/translatehtml.js | 14 ++------------ assets/vue/views/course/CourseHome.vue | 8 +++++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/assets/css/scorm.scss b/assets/css/scorm.scss index 53f9c9eaa3..a6c06d8bf4 100644 --- a/assets/css/scorm.scss +++ b/assets/css/scorm.scss @@ -444,6 +444,7 @@ body { .icon-toolbar .fa:hover, .icon-toolbar .mdi:hover { + color: #666666; } .expand .fa, diff --git a/assets/js/translatehtml.js b/assets/js/translatehtml.js index 297839334b..90d01575b7 100644 --- a/assets/js/translatehtml.js +++ b/assets/js/translatehtml.js @@ -1,20 +1,13 @@ /* For licensing terms, see /license.txt */ -import { usePlatformConfig } from "../vue/store/platformConfig" - function normalizeLocale(locale) { return locale.split('_')[0] } -export default async function translateHtml() { - try { - const platformConfigStore = usePlatformConfig() - await platformConfigStore.initialize() - +export default function translateHtml() { if ( window.user && - window.user.locale && - "true" === platformConfigStore.getSetting("editor.translate_html") + window.user.locale ) { var isoCode = normalizeLocale(window.user.locale) const translateElement = document.querySelector(".mce-translatehtml") @@ -50,7 +43,4 @@ export default async function translateHtml() { } } } - } catch (error) { - console.error("Error in translateHtml:", error) - } } diff --git a/assets/vue/views/course/CourseHome.vue b/assets/vue/views/course/CourseHome.vue index e3fa3e10ed..d3a339c4e0 100644 --- a/assets/vue/views/course/CourseHome.vue +++ b/assets/vue/views/course/CourseHome.vue @@ -382,9 +382,11 @@ const isAllowedToEdit = ref(false) onMounted(async () => { isAllowedToEdit.value = await checkIsAllowedToEdit() - setTimeout(() => { - translateHtml() - }, 1000) + if ("true" === platformConfigStore.getSetting("editor.translate_html")) { + setTimeout(() => { + translateHtml() + }, 1000) + } }) const onStudentViewChanged = async () => {