no message

This commit is contained in:
Armamem0t 2025-07-01 10:25:43 +08:00
parent 570c41bc11
commit 3071859a3d
Signed by: minglipro
GPG Key ID: 5F355A77B22AA93B
4 changed files with 18 additions and 45 deletions

View File

@ -9,6 +9,7 @@
"build-jar-auto": "run-p \"build-only\" && gradle -Dorg.gradle.java.home=/opt/jdk/21.0.7/ build-jar", "build-jar-auto": "run-p \"build-only\" && gradle -Dorg.gradle.java.home=/opt/jdk/21.0.7/ build-jar",
"build": "run-p type-check \"build-only {@}\" --", "build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview", "preview": "vite preview",
"build-preview": "run-p build-only && vite preview",
"build-only": "vite build", "build-only": "vite build",
"type-check": "vue-tsc --build", "type-check": "vue-tsc --build",
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore", "lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",

View File

@ -16,7 +16,7 @@
}" }"
@click="router.push({ name: 'home' })"> @click="router.push({ name: 'home' })">
<Icon icon="material-symbols:home" /> <Icon icon="material-symbols:home" />
{{ t('nav.title.home') }} {{ $t('nav.title.home') }}
<div class="after"></div> <div class="after"></div>
</div> </div>
<div <div
@ -86,15 +86,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import Icon from '@/components/Icon.vue'; import Icon from '@/components/Icon.vue';
import { UseBoolRef } from '@/util'; import { UseBoolRef } from '@/util';
import { import { type languageIndexItemValueType, message, messageData, router, UseAuthStore, UseSettingStore } from '@/plugin';
type languageIndexItemValueType,
message,
messageData,
router,
t,
UseAuthStore,
UseSettingStore,
} from '@/plugin';
import { getSysInfo } from '@/api/system.ts'; import { getSysInfo } from '@/api/system.ts';
import type { SelectOption } from 'naive-ui/es/select/src/interface'; import type { SelectOption } from 'naive-ui/es/select/src/interface';
import type { VNodeChild } from 'vue'; import type { VNodeChild } from 'vue';

View File

@ -4,13 +4,13 @@ import './assets/index.sass';
import { createApp } from 'vue'; import { createApp } from 'vue';
import App from './App.vue'; import App from './App.vue';
import { installI18n, pinia, router } from './plugin'; import { i18n, installI18n, pinia, router } from './plugin';
installI18n().then((i18n) => { const app = createApp(App);
const app = createApp(App); app.use(i18n);
app.use(i18n); app.use(pinia);
app.use(pinia); app.use(router);
app.use(router); app.mount('#app');
app.mount('#app'); console.log(i18n);
console.log(i18n);
}); await installI18n();

View File

@ -32,22 +32,12 @@ export const messages: languageType | any = {};
export const messageData = ref<languageIndexItemValueType[]>([]); export const messageData = ref<languageIndexItemValueType[]>([]);
export let i18n: ReturnType< export const i18n = createI18n({
typeof createI18n< legacy: false,
{ locale: 'zh-cn',
legacy: boolean; fallbackLocale: 'zh-cn',
locale: string; messages,
fallbackLocale: string; });
messages: any;
},
any,
any
>
>;
export function t(data: string): string {
return i18n.global.t(data);
}
export async function installI18n() { export async function installI18n() {
const data: languageIndexType = await loadIndexFile(); const data: languageIndexType = await loadIndexFile();
@ -59,14 +49,4 @@ export async function installI18n() {
}); });
messages[i.id] = await loadLanguageFile(i.file); messages[i.id] = await loadLanguageFile(i.file);
} }
console.log(messages);
console.log(languagedatas);
console.log(messageData);
i18n = createI18n({
legacy: false,
locale: 'zh-cn',
fallbackLocale: 'zh-cn',
messages,
});
return i18n;
} }