Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/assets/vue/i18n.js

28 lines
619 B

import { createI18n } from "vue-i18n"
function loadLocaleMessages() {
const locales = require.context("./../locales", true, /[A-Za-z0-9-_,\s]+\.json$/i)
const messages = {}
locales.keys().forEach((key) => {
const matched = key.match(/([A-Za-z0-9-_]+)\./i)
if (matched && matched.length > 1) {
const locale = matched[1]
messages[locale] = locales(key)
}
})
return messages
}
let locale = document.querySelector("html").lang
if (!locale) {
locale = "en"
}
export default createI18n({
legacy: false,
locale: locale,
fallbackLocale: "en",
messages: loadLocaleMessages(),
})