|
|
@ -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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|