mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-05-15 07:25:21 +08:00
944 B
944 B
trigger
| trigger |
|---|
| always_on |
国际化规范
文件组织
src/i18n/
├── zh-cn/
│ ├── common.ts
│ ├── system.ts
│ ├── ai.ts
│ └── ...
└── en/
├── common.ts
├── system.ts
└── ...
- 按模块拆分,每个业务模块一个文件
- 命名空间以模块名为根 key(如
system.account.name)
使用方式
<template>
<h1>{{ $t('system.account.name') }}</h1>
<el-button>{{ $t('common.save') }}</el-button>
</template>
<script setup>
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const message = t('common.success');
</script>
边界
- ✅ Always: 所有展示文本通过
$t()或t()获取 - ✅ Always: 枚举的 label 必须是国际化 key
- ✅ Always: 新增模块时在
zh-cn/和en/下同时创建语言文件 - 🚫 Never: 在组件中直接写中文/英文文本