You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/oaweb/plugins/third.ts

35 lines
782 B
TypeScript

4 weeks ago
/*
* third.ts
* Copyright (C) 2024 veypi <i@veypi.com>
* 2024-10-29 19:52
* Distributed under terms of the GPL license.
*/
import oneicon from '@veypi/one-icon'
4 weeks ago
import { createI18n } from 'vue-i18n'
import langEn from './i18n/en'
import langZh from './i18n/zh'
4 weeks ago
4 weeks ago
const navLang = navigator.language; //判断当前浏览器使用的语言
const localLang = navLang === 'zh-CN' ? 'zh-CN' : 'en-US';
let lang = localStorage.getItem('lang') || localLang || 'en-US';
export const i18n = createI18n({
locale: lang,
fallbackLocale: 'en',
messages: {
en: langEn,
zh: langZh,
},
modifiers: {
snakeCase: (str: any) => str.split(' ').join('_')
}
});
4 weeks ago
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(oneicon)
4 weeks ago
nuxtApp.vueApp.use(i18n)
4 weeks ago
})