fix: 完善平台国际化覆盖

This commit is contained in:
Nixevol
2026-07-05 00:53:03 +08:00
parent 66d16a6524
commit 4d32a117e2
16 changed files with 295 additions and 111 deletions
+14 -2
View File
@@ -1,9 +1,21 @@
import { createDiscreteApi } from 'naive-ui';
import { computed } from 'vue';
import { createDiscreteApi, darkTheme, dateEnUS, dateZhCN, enUS, zhCN } from 'naive-ui';
import { i18n } from '@/locales';
import { themeOverrides } from '@/theme';
import { useTheme } from '@/composables/useTheme';
// 全局可用的消息/对话框/加载条(含在 setup 之外,如 axios 拦截器)
const { isDark } = useTheme();
const { message, dialog, loadingBar } = createDiscreteApi(['message', 'dialog', 'loadingBar'], {
configProviderProps: { themeOverrides },
configProviderProps: computed(() => {
const isEnglish = i18n.global.locale.value === 'en-US';
return {
theme: isDark.value ? darkTheme : null,
themeOverrides,
locale: isEnglish ? enUS : zhCN,
dateLocale: isEnglish ? dateEnUS : dateZhCN,
};
}),
});
export { message, dialog, loadingBar };
+3 -2
View File
@@ -1,6 +1,7 @@
import { h } from 'vue';
import { NButton, NDropdown, NIcon, type DropdownOption } from 'naive-ui';
import { FilterOutline } from '@vicons/ionicons5';
import { i18n } from '@/locales';
export interface TableFilterOption {
label: string;
@@ -12,7 +13,7 @@ export function renderTableFilterTitle(
value: string | number | null | undefined,
options: TableFilterOption[],
onSelect: (value: string | number | null) => void,
allLabel = '全部',
allLabel = i18n.global.t('common.label.all'),
) {
const active = value !== null && value !== undefined && value !== '';
const dropdownOptions: DropdownOption[] = [
@@ -32,7 +33,7 @@ export function renderTableFilterTitle(
default: () =>
h(
NButton,
{ quaternary: true, circle: true, size: 'tiny', class: ['filter-trigger', { active }], title: '筛选' },
{ quaternary: true, circle: true, size: 'tiny', class: ['filter-trigger', { active }], title: i18n.global.t('common.action.filter') },
{ icon: () => h(NIcon, null, { default: () => h(FilterOutline) }) },
),
},