Skip to content

Commit

Permalink
refactor(i18n): update translation keys for better organization and c…
Browse files Browse the repository at this point in the history
…larity
  • Loading branch information
ShiinaKin committed Nov 18, 2024
1 parent e3edee4 commit 9819ebe
Show file tree
Hide file tree
Showing 12 changed files with 250 additions and 251 deletions.
4 changes: 2 additions & 2 deletions ui/src/components/DragUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const handleFiles = (files: FileList) => {
<input type="file" ref="fileInput" @change="onFileSelected" multiple class="hidden" />
<div class="text-gray-500">
<Icon icon="mdi:cloud-upload-outline" class="mx-auto size-12 text-gray-400" />
<p class="mt-2 text-sm">{{ t("message.dragUploaderUsageTip") }}</p>
<p class="mt-1 text-sm">{{ t("message.dragUploaderAllowedFileTypeTip") }} {{ allowedImageTypes }}</p>
<p class="mt-2 text-sm">{{ t("dragUploader.dragUploaderUsageTip") }}</p>
<p class="mt-1 text-sm">{{ t("dragUploader.dragUploaderAllowedFileTypeTip") }} {{ allowedImageTypes }}</p>
</div>
</div>
</template>
23 changes: 11 additions & 12 deletions ui/src/locales/zh_cn.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
message:
# siteInitView
siteInitView:
siteInitTitle: "站点初始化"
siteInitDesc: "这是系统初始化后的首次访问,请先初始化站点"
siteInitSubmitButton: "提交"
Expand All @@ -19,15 +18,15 @@ message:
siteInitPasswordRequirements: "密码长度必须在8到32个字符之间。只能为大小写字母、数字和特殊符号的组合,必须有字母和数字。"
siteInitEmailPlaceholder: "请输入邮箱"
siteInitEmailRequirements: "请输入正确的邮箱地址。"
# loginView
loginView:
loginTitle: "登录"
loginUsernamePlaceholder: "请输入用户名"
loginUsernameRequirements: "用户名必须是4-20个字符,只能包含字母和数字。"
loginPasswordPlaceholder: "请输入密码"
loginPasswordRequirements: "密码长度必须在8到32个字符之间。只能为大小写字母、数字和特殊符号的组合,必须有字母和数字。"
loginSubmitButton: "登录"
loginSignupButton: "注册"
# registerView
registerView:
registerTitle: "注册"
registerUsernamePlaceholder: "请输入用户名"
registerUsernameRequirements: "用户名必须是4-20个字符,只能包含字母和数字。"
Expand All @@ -37,7 +36,7 @@ message:
registerEmailRequirements: "请输入正确的邮箱地址。"
registerSubmitButton: "注册"
registerLoginButton: "登录"
# userField
userField:
userMenuOverview: "概览"
userMenuUploadImage: "上传图片"
userMenuMyImage: "我的图片"
Expand All @@ -48,7 +47,7 @@ message:
userMenuAdminField: "管理后台"
userMenuLogout: "退出登录"
userMenuLogoutSuccess: "登出成功"
# userOverviewView
userOverviewView:
userOverviewImageCount: "图片数量"
userOverviewAlbumCount: "相册数量"
userOverviewUsedSpace: "已用空间"
Expand All @@ -57,15 +56,15 @@ message:
userOverviewImageCountUnit: ""
userOverviewAlbumCountUnit: ""
userOverviewUsableSpaceTip: "总空间 - 已用空间"
# dragUploader
dragUploader:
dragUploaderUsageTip: "点击或拖拽文件到此处上传"
dragUploaderAllowedFileTypeTip: "支持的文件类型:"
# imageUploadView
imageUploadView:
imageUploadTitle: "上传图片"
imageUploadDescription: "在下方选择图片文件,然后在上传列表进行操作"
imageUploadUploadList: "上传列表"
imageUploadUploadAllButton: "上传全部"
# myImageView
myImageView:
myImageFilterUploadTimeASC: "上传时间升序"
myImageFilterUploadTimeDESC: "上传时间降序"
myImageFilterFileSizeASC: "文件大小升序"
Expand Down Expand Up @@ -113,7 +112,7 @@ message:
myImageDialogImageChangeAlbumWarningMessage: "请选择相册"
myImageDialogImageChangeAlbumSuccessMessage: "修改相册成功"
myImageDialogImageChangeAlbumFailedTitle: "修改相册失败"
# myAlbumView
myAlbumView:
myAlbumCreateButton: "创建相册"
myAlbumTableAlbumId: "相册ID"
myAlbumTableAlbumName: "相册名"
Expand Down Expand Up @@ -154,7 +153,7 @@ message:
myAlbumDetailDialogAlbumIsUncategorized: "是否为未分类"
myAlbumDetailDialogAlbumIsDefault: "是否默认"
myAlbumDetailDialogAlbumCreateTime: "创建时间"
# profileView
myProfileView:
profileTitle: "我的资料"
profileUpdateButton: "修改资料"
profileEditDialogTitle: "修改资料"
Expand Down Expand Up @@ -184,7 +183,7 @@ message:
profileIsDefaultImagePrivate: "默认私密"
profileIsDefaultImagePrivateTrue: ""
profileIsDefaultImagePrivateFalse: ""
# patView
myPatView:
myPATCreateButton: "创建令牌"
myPATTablePATId: "令牌ID"
myPATTablePATName: "令牌名"
Expand Down
14 changes: 7 additions & 7 deletions ui/src/views/auth/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function handleSubmit() {
@submit.prevent="handleSubmit"
class="mb-0 mt-6 space-y-4 rounded-lg p-4 shadow-lg sm:p-6 lg:p-8"
>
<p class="text-center text-lg font-medium">{{ t("message.loginTitle") }}</p>
<p class="text-center text-lg font-medium">{{ t("loginView.loginTitle") }}</p>

<div>
<label for="username" class="sr-only">Username</label>
Expand All @@ -60,10 +60,10 @@ function handleSubmit() {
type="text"
autocomplete="username"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.loginUsernamePlaceholder')"
:placeholder="t('loginView.loginUsernamePlaceholder')"
v-model="userLoginForm.username"
pattern="^[a-zA-Z0-9]{4,20}$"
:title="t('message.loginUsernameRequirements')"
:title="t('loginView.loginUsernameRequirements')"
required
/>

Expand All @@ -82,10 +82,10 @@ function handleSubmit() {
type="password"
autocomplete="current-password"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.loginPasswordPlaceholder')"
:placeholder="t('loginView.loginPasswordPlaceholder')"
v-model="userLoginForm.password"
pattern="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,32}$"
:title="t('message.loginPasswordRequirements')"
:title="t('loginView.loginPasswordRequirements')"
required
/>

Expand All @@ -96,12 +96,12 @@ function handleSubmit() {
</div>

<button type="submit" class="block w-full rounded-lg bg-indigo-600 px-5 py-3 text-sm font-medium text-white">
{{ t("message.loginSubmitButton") }}
{{ t("loginView.loginSubmitButton") }}
</button>

<p v-if="commonStore.allowSignup" class="text-center text-sm text-gray-500">
<a class="underline" href="#" @click="router.push({ name: 'register' })">{{
t("message.loginSignupButton")
t("loginView.loginSignupButton")
}}</a>
</p>
</form>
Expand Down
18 changes: 9 additions & 9 deletions ui/src/views/auth/RegisterView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function handleSubmit() {
@submit.prevent="handleSubmit"
class="mb-0 mt-6 space-y-4 rounded-lg p-4 shadow-lg sm:p-6 lg:p-8"
>
<p class="text-center text-lg font-medium">{{ t("message.registerTitle") }}</p>
<p class="text-center text-lg font-medium">{{ t("registerView.registerTitle") }}</p>

<div>
<label for="username" class="sr-only">Username</label>
Expand All @@ -59,10 +59,10 @@ function handleSubmit() {
type="text"
autocomplete="username"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.registerUsernamePlaceholder')"
:placeholder="t('registerView.registerUsernamePlaceholder')"
v-model="userRegisterForm.username"
pattern="^[a-zA-Z0-9]{4,20}$"
:title="t('message.registerUsernameRequirements')"
:title="t('registerView.registerUsernameRequirements')"
required
/>

Expand All @@ -81,10 +81,10 @@ function handleSubmit() {
type="password"
autocomplete="new-password"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.registerPasswordPlaceholder')"
:placeholder="t('registerView.registerPasswordPlaceholder')"
v-model="userRegisterForm.password"
pattern="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,32}$"
:title="t('message.registerPasswordRequirements')"
:title="t('registerView.registerPasswordRequirements')"
required
/>

Expand All @@ -102,9 +102,9 @@ function handleSubmit() {
id="email"
type="email"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.registerEmailPlaceholder')"
:placeholder="t('registerView.registerEmailPlaceholder')"
v-model="userRegisterForm.email"
:title="t('message.registerEmailRequirements')"
:title="t('registerView.registerEmailRequirements')"
required
/>

Expand All @@ -115,12 +115,12 @@ function handleSubmit() {
</div>

<button type="submit" class="block w-full rounded-lg bg-indigo-600 px-5 py-3 text-sm font-medium text-white">
{{ t("message.registerSubmitButton") }}
{{ t("registerView.registerSubmitButton") }}
</button>

<p class="text-center text-sm text-gray-500">
<a class="underline" href="#" @click="router.push({ name: 'login' })">{{
t("message.registerLoginButton")
t("registerView.registerLoginButton")
}}</a>
</p>
</form>
Expand Down
34 changes: 17 additions & 17 deletions ui/src/views/init/SiteInitView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ function handleSubmit() {
<div class="mx-auto max-w-screen-xl px-4 py-16 sm:px-6 lg:px-8">
<div class="mx-auto max-w-lg text-center">
<h1 class="text-2xl font-bold sm:text-3xl">
{{ t("message.siteInitTitle") }}
{{ t("siteInitView.siteInitTitle") }}
</h1>

<p class="mt-4 text-gray-500">
{{ t("message.siteInitDesc") }}
{{ t("siteInitView.siteInitDesc") }}
</p>
</div>

Expand All @@ -60,10 +60,10 @@ function handleSubmit() {
id="siteTitle"
type="text"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.siteInitSiteTitlePlaceholder')"
:placeholder="t('siteInitView.siteInitSiteTitlePlaceholder')"
pattern="\S+.*"
v-model="siteInitForm.siteTitle"
:title="t('message.siteInitSiteTitleRequirements')"
:title="t('siteInitView.siteInitSiteTitleRequirements')"
required
/>

Expand All @@ -81,9 +81,9 @@ function handleSubmit() {
id="siteSubTitle"
type="text"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.siteInitSiteSubtitlePlaceholder')"
:placeholder="t('siteInitView.siteInitSiteSubtitlePlaceholder')"
v-model="siteInitForm.siteSubtitle"
:title="t('message.siteInitSiteSubtitleRequirements')"
:title="t('siteInitView.siteInitSiteSubtitleRequirements')"
required
/>

Expand All @@ -101,9 +101,9 @@ function handleSubmit() {
id="siteDescription"
type="text"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.siteInitSiteDescriptionPlaceholder')"
:placeholder="t('siteInitView.siteInitSiteDescriptionPlaceholder')"
v-model="siteInitForm.siteDescription"
:title="t('message.siteInitSiteDescriptionRequirements')"
:title="t('siteInitView.siteInitSiteDescriptionRequirements')"
required
/>

Expand All @@ -121,9 +121,9 @@ function handleSubmit() {
id="siteExternalUrl"
type="url"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.siteInitSiteExternalUrlPlaceholder')"
:placeholder="t('siteInitView.siteInitSiteExternalUrlPlaceholder')"
v-model="siteInitForm.siteExternalUrl"
:title="t('message.siteInitSiteExternalUrlRequirements')"
:title="t('siteInitView.siteInitSiteExternalUrlRequirements')"
required
/>

Expand All @@ -142,10 +142,10 @@ function handleSubmit() {
type="text"
autocomplete="username"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.siteInitUsernamePlaceholder')"
:placeholder="t('siteInitView.siteInitUsernamePlaceholder')"
v-model="siteInitForm.username"
pattern="^[a-zA-Z0-9]{4,20}$"
:title="t('message.siteInitUsernameRequirements')"
:title="t('siteInitView.siteInitUsernameRequirements')"
required
/>

Expand All @@ -164,10 +164,10 @@ function handleSubmit() {
type="password"
autocomplete="new-password"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.siteInitPasswordPlaceholder')"
:placeholder="t('siteInitView.siteInitPasswordPlaceholder')"
v-model="siteInitForm.password"
pattern="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,32}$"
:title="t('message.siteInitPasswordRequirements')"
:title="t('siteInitView.siteInitPasswordRequirements')"
required
/>

Expand All @@ -185,9 +185,9 @@ function handleSubmit() {
id="email"
type="email"
class="w-full rounded-lg border-gray-200 p-4 pe-12 text-sm shadow-sm"
:placeholder="t('message.siteInitEmailPlaceholder')"
:placeholder="t('siteInitView.siteInitEmailPlaceholder')"
v-model="siteInitForm.email"
:title="t('message.siteInitEmailRequirements')"
:title="t('siteInitView.siteInitEmailRequirements')"
required
/>

Expand All @@ -202,7 +202,7 @@ function handleSubmit() {
type="submit"
class="w-1/2 inline-block rounded-lg bg-blue-500 px-5 py-3 text-sm font-medium text-white"
>
{{ t("message.siteInitSubmitButton") }}
{{ t("siteInitView.siteInitSubmitButton") }}
</button>
</div>
</form>
Expand Down
Loading

0 comments on commit 9819ebe

Please sign in to comment.