📝 更新i18n

This commit is contained in:
7836246 2024-03-18 00:37:32 +08:00
parent 4c6250b1f9
commit 5b84925176
7 changed files with 67 additions and 15 deletions

View File

@ -10,6 +10,9 @@ Nuxt-Whois 是一个基于 Nuxt3、Tailwind CSS 和 Xep-Whois 构建的Whois查
- **Dns查询**支持Dns查询方便用户查看域名的Dns信息。 - **Dns查询**支持Dns查询方便用户查看域名的Dns信息。
- **自定义后缀**支持自定义Whois服务器后缀方便用户查询不同后缀的域名。 - **自定义后缀**支持自定义Whois服务器后缀方便用户查询不同后缀的域名。
### 内容修改
大部分多语言文字都在lang文件夹下或者.env文件可以自行修改。
### 环境要求 ### 环境要求
- Node.js 18.x 或更高版本 - Node.js 18.x 或更高版本

View File

@ -1,17 +1,20 @@
<template> <template>
<div class="px-4 space-y-4"> <div class="px-4 space-y-4">
<div class="flex gap-2 items-center"> <div class="flex gap-2 items-center">
<UInput v-model="newDomainSuffix" @input="searchSuffix" placeholder="域名后缀,如 .cn" class="flex-grow rounded shadow transition duration-200 ease-in-out" /> <UInput v-model="newDomainSuffix" @input="searchSuffix" :placeholder="t('settings.suffixPlaceholder')" class="flex-grow rounded shadow transition duration-200 ease-in-out" />
<UInput v-model="newWhoisServer" placeholder="Whois服务器如 whois.cnnic.net.cn" class="flex-grow border-gray-300 rounded shadow transition duration-200 ease-in-out" /> <UInput v-model="newWhoisServer" :placeholder="t('settings.whoisPlaceholder')" class="flex-grow border-gray-300 rounded shadow transition duration-200 ease-in-out" />
<UButton @click="addSuffix" type="button" :disabled="suffixExists" class="p-2 bg-blue-500 text-white rounded hover:bg-blue-700 shadow disabled:bg-gray-400 disabled:cursor-not-allowed transition duration-200 ease-in-out">添加</UButton> <UButton @click="addSuffix" type="button" :disabled="suffixExists" class="p-2 bg-blue-500 text-white rounded hover:bg-blue-700 shadow disabled:bg-gray-400 disabled:cursor-not-allowed transition duration-200 ease-in-out">
{{ t('common.actions.add') }}</UButton>
</div> </div>
<div class="text-sm" v-if="suffixExists"> <div class="text-sm" v-if="suffixExists">
<span class="text-red-500">后缀已存在</span> <span class="text-red-500">{{ t('common.actions.suffixExist') }}</span>
</div> </div>
<div class="overflow-auto h-64 mt-4 bg-gray-50 rounded shadow"> <div class="overflow-auto h-64 mt-4 bg-gray-50 rounded shadow">
<div v-for="(server, suffix) in domainStore.SupportedTLDs" :key="suffix" class="flex items-center justify-between p-2 border-b border-gray-200 last:border-b-0"> <div v-for="(server, suffix) in domainStore.SupportedTLDs" :key="suffix" class="flex items-center justify-between p-2 border-b border-gray-200 last:border-b-0">
<div>{{ suffix }}: {{ server }}</div> <div>{{ suffix }}: {{ server }}</div>
<UButton @click="removeSuffix(suffix)" type="button" class="bg-red-500 hover:bg-red-700 text-white p-1 rounded shadow transition duration-200 ease-in-out">删除</UButton> <UButton @click="removeSuffix(suffix)" type="button" class="bg-red-500 hover:bg-red-700 text-white p-1 rounded shadow transition duration-200 ease-in-out">
{{ t('common.actions.delete') }}
</UButton>
</div> </div>
</div> </div>
</div> </div>
@ -24,6 +27,7 @@ const newWhoisServer = ref('');
const suffixExists = computed(() => newDomainSuffix.value in domainStore.SupportedTLDs); const suffixExists = computed(() => newDomainSuffix.value in domainStore.SupportedTLDs);
const toast = useToast() const toast = useToast()
const {t} = useI18n();
const addSuffix = async () => { const addSuffix = async () => {
if (newDomainSuffix.value && newWhoisServer.value && !suffixExists.value) { if (newDomainSuffix.value && newWhoisServer.value && !suffixExists.value) {
@ -31,7 +35,7 @@ const addSuffix = async () => {
newDomainSuffix.value = ''; newDomainSuffix.value = '';
newWhoisServer.value = ''; newWhoisServer.value = '';
toast.add( toast.add(
{ title: '添加成功' } { title: '`添加成功`' }
); );
} }
}; };

View File

@ -8,6 +8,7 @@ export default defineI18nLocale(async locale => {
delete: 'Delete', delete: 'Delete',
reset: 'Reset', reset: 'Reset',
confirm: 'Confirm', confirm: 'Confirm',
add: 'Add',
} }
}, },
whois:{ whois:{
@ -147,6 +148,19 @@ export default defineI18nLocale(async locale => {
currentWindow: 'Current Window', currentWindow: 'Current Window',
//新窗口 //新窗口
newWindow: 'New Window', newWindow: 'New Window',
// 后缀设置
suffixSetting: 'Suffix Settings',
// 后缀管理
suffixManage: 'Suffix Management',
// 自定义后缀
customSuffix: 'Custom Suffix',
// 自定义编辑管理添加后缀
suffixDesc: 'Customize the suffix to be added',
// 管理
manage: 'Manage',
suffixPlaceholder: 'Please enter the suffix',
whoisPlaceholder: 'Please enter the whois server',
suffixExist: 'The suffix already exists',
}, },
} }
}) })

View File

@ -10,6 +10,8 @@ export default defineI18nLocale(async locale => {
reset: '重置', reset: '重置',
//確定 //確定
confirm: '確定', confirm: '確定',
//新增
add: '新增',
} }
}, },
whois: { whois: {
@ -153,6 +155,20 @@ export default defineI18nLocale(async locale => {
currentWindow: '當前視窗', currentWindow: '當前視窗',
// 新視窗 // 新視窗
newWindow: '新視窗', newWindow: '新視窗',
// 字尾設定
suffixSetting: '字尾設定',
// 字尾管理
suffixManage: '字尾管理',
// 自定義字尾
customSuffix: '自定義字尾',
// 自定義編輯管理新增字尾
suffixDesc: '自定義編輯管理新增字尾',
// 管理
manage: '管理',
suffixPlaceholder: '域名字尾,如 .cn',
whoisPlaceholder: 'Whois伺服器如 whois.cnnic.net.cn',
// 字尾已存在
suffixExist: '字尾已存在',
} }
} }
}) })

View File

@ -11,6 +11,8 @@ export default defineI18nLocale(async locale => {
reset: '重置', reset: '重置',
//确定 //确定
confirm: '确定', confirm: '确定',
//添加
add: '添加',
} }
}, },
whois:{ whois:{
@ -159,6 +161,20 @@ export default defineI18nLocale(async locale => {
currentWindow: '当前窗口', currentWindow: '当前窗口',
// 新窗口 // 新窗口
newWindow: '新窗口', newWindow: '新窗口',
// 后缀设置
suffixSetting: '后缀设置',
// 后缀管理
suffixManage: '后缀管理',
// 自定义后缀
customSuffix: '自定义后缀',
// 自定义编辑管理添加后缀
suffixDesc: '自定义编辑管理添加后缀',
// 管理
manage: '管理',
suffixPlaceholder: '域名后缀,如 .cn',
whoisPlaceholder: 'Whois服务器如 whois.cnnic.net.cn',
// 后缀已存在
suffixExist: '后缀已存在',
} }
} }
}) })

View File

@ -15,17 +15,16 @@ export default defineNuxtConfig({
} , } ,
runtimeConfig: { runtimeConfig: {
public: { public: {
Domain: 'Nuxt Whois', Domain: process.env.WebSiteDomain,
DomainSuffix: 'Dns', DomainSuffix: process.env.WebSiteDomainSuffix,
} }
}, },
app:{ app:{
head: { head: {
title: 'Nuxt Whois', title: process.env.WebSiteTitle,
meta: [ meta: [
{ charset: 'utf-8' }, { charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt Whois' }
], ],
link: [ link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }

View File

@ -40,17 +40,17 @@ const handleReset = async () => {
</div> </div>
<div class="setting"> <div class="setting">
<div class="text-2xl font-bold mt-[30px] mb-[20px]"> 后缀设置 </div> <div class="text-2xl font-bold mt-[30px] mb-[20px]"> {{ t('settings.suffixSetting') }} </div>
<u-card class="set-item"> <u-card class="set-item">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div class="text-base"> 自定义后缀 </div> <div class="text-base"> {{ t('settings.customSuffix') }} </div>
<div class="text-sm " > <div class="text-sm " >
自定义编辑管理添加后缀 {{ t('settings.suffixDesc') }}
</div> </div>
<div> <div>
<u-button type="warning" <u-button type="warning"
@click="isEditDomainOpen = true" @click="isEditDomainOpen = true"
> 管理 </u-button> > {{ t('settings.manage') }} </u-button>
</div> </div>
</div> </div>
@ -70,7 +70,7 @@ const handleReset = async () => {
<template #header> <template #header>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white"> <h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
后缀管理 {{ t('settings.suffixManage') }}
</h3> </h3>
<UButton <UButton
color="gray" color="gray"