feat: add switch with zh|en

This commit is contained in:
2025-07-28 23:36:33 +08:00
parent 7bfb909532
commit a186439b84
14 changed files with 536 additions and 260 deletions

View File

@@ -0,0 +1,63 @@
import { createI18n } from 'vue-i18n';
const messages = {
zh: {
howItWorks: {
title: '工作原理',
step1: '在上面的输入框中,随意编造一个以 {domain} 结尾的邮箱地址。',
step2: '使用这个地址去注册任何网站或接收邮件。',
step3: '在这里输入您刚刚使用的地址,点击“查看收件箱”,即可看到邮件。',
},
language: '语言',
home: {
title: '您的专属临时邮箱,无限且私密',
subtitle: '输入任何',
subtitleAfter: '地址,立即在此查看收件箱。',
placeholder: '输入您的临时邮箱地址...',
copyTitle: '复制地址',
random: '随机生成',
checkInbox: '查看收件箱',
inbox: '收件箱',
refresh: '刷新',
loading: '正在加载...',
noMail: '暂无邮件',
selectMail: '请从选择一封邮件查看',
from: '发件人',
to: '收件人',
}
},
en: {
howItWorks: {
title: 'How it Works',
step1: 'Invent any email address ending in {domain} in the input box above.',
step2: 'Use this address to register on any website or receive emails.',
step3: 'Enter the address you just used here and click "Check Inbox" to see the emails.',
},
language: 'Language',
home: {
title: 'Your Exclusive, Unlimited, and Private Temporary Email',
subtitle: 'Enter any address ending in ',
subtitleAfter: ' to check the inbox right here.',
placeholder: 'Enter your temporary email address...',
copyTitle: 'Copy Address',
random: 'Generate Random',
checkInbox: 'Check Inbox',
inbox: 'Inbox',
refresh: 'Refresh',
loading: 'Loading...',
noMail: 'No mail yet',
selectMail: 'Please select an email to view',
from: 'From',
to: 'To',
}
},
};
const i18n = createI18n({
legacy: false, // 使用组合式 API
locale: 'zh', // 设置默认语言
fallbackLocale: 'en', // 设置回退语言
messages, // 设置语言环境信息
});
export default i18n;