refactor(#7598): add i18n dynamic typings (#10882)

* refactor: add i18n dynamic typings

* chore: tweak
This commit is contained in:
Acid Chicken (硫酸鶏) 2023-05-24 17:12:38 +09:00 committed by GitHub
parent 38a1d6693a
commit 62fe3bfb54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2222 additions and 3 deletions

View file

@ -1,8 +1,9 @@
import { markRaw } from 'vue';
import type { Locale } from '../../../locales';
import { locale } from '@/config';
import { I18n } from '@/scripts/i18n';
export const i18n = markRaw(new I18n(locale));
export const i18n = markRaw(new I18n<Locale>(locale));
export function updateI18n(newLocale) {
i18n.ts = newLocale;

View file

@ -6,6 +6,7 @@ import { type UserConfig, defineConfig } from 'vite';
import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
import locales from '../../locales';
import generateDTS from '../../locales/generateDTS';
import meta from '../../package.json';
import pluginJson5 from './vite.json5';
@ -64,6 +65,10 @@ export function getConfig(): UserConfig {
}),
]
: [],
{
name: 'locale:generateDTS',
buildStart: generateDTS,
},
],
resolve: {