Skip to content

Commit

Permalink
patch missing and wrong translation key
Browse files Browse the repository at this point in the history
  • Loading branch information
DAYGoodTime authored and arily committed Aug 5, 2023
1 parent 8f07f74 commit 9791fc5
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 40 deletions.
14 changes: 12 additions & 2 deletions src/components/userpage/heading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ onBeforeMount(() => {
isFriendButtonHovered = useElementHover(changeFriendStateButton)
})
const friendButtonContent = computed(
() => data.value?.friendCount || 'Add as friend'
() => data.value?.friendCount || t('add-as-friend')
)
async function toggleFriend() {
if (!session.loggedIn) {
Expand All @@ -76,6 +76,16 @@ en-GB:
offline: Offline, last seen at {lastSeen}
idle: Online.
afk: AFK
edit: Edit
add-as-friend: Add as friend

zh-CN:
status:
offline: 离线, 上次在线时间 {lastSeen}
idle: 在线.
afk: AFK
edit: 编辑
add-as-friend: 添加为好友
</i18n>

<template>
Expand Down Expand Up @@ -146,7 +156,7 @@ en-GB:
name: 'me-settings',
}"
>
Edit
{{ t('edit') }}
</t-nuxt-link-locale-button>
</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useSearchablePages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const pages: {
show: loggedIn,
},
{
render: () => <><icon name="majesticons:logout-half-circle-line" class="w-5 h-5" size="100%" />{ useI18n().t('gloabl.logout') }</>,
render: () => <><icon name="majesticons:logout-half-circle-line" class="w-5 h-5" size="100%" />{ useI18n().t('global.logout') }</>,
route: {
name: 'auth-logout',
},
Expand Down
42 changes: 21 additions & 21 deletions src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
'relations': '好友 & 黑名单',
'userpage': '用户页面',
'admin-panel': '管理面板',
'logs': '',
'logs': '系统日志',
'articles': '文章',
},
global: {
Expand All @@ -41,27 +41,27 @@ export default {
'play-count': '游玩次数',
},
priv: {
[UserPrivilege.Disabled]: '',
[UserPrivilege.Restricted]: '',
[UserPrivilege.Registered]: '',
[UserPrivilege.Inactive]: '',
[UserPrivilege.Normal]: '',
[UserPrivilege.Supported]: '',
[UserPrivilege.Supporter]: '',
[UserPrivilege.Whitelisted]: '',
[UserPrivilege.Alumni]: '',
[UserPrivilege.TournamentStuff]: '',
[UserPrivilege.ChannelModerator]: '',
[UserPrivilege.Moderator]: '',
[UserPrivilege.BeatmapNominator]: '',
[UserPrivilege.Staff]: '',
[UserPrivilege.Admin]: '',
[UserPrivilege.Owner]: '',
[UserPrivilege.Bot]: '',
[UserPrivilege.Disabled]: '被禁用',
[UserPrivilege.Restricted]: '已被封禁',
[UserPrivilege.Registered]: '已注册',
[UserPrivilege.Inactive]: '不活跃的',
[UserPrivilege.Normal]: '普通',
[UserPrivilege.Supported]: 'Supporter',
[UserPrivilege.Supporter]: '赞助者',
[UserPrivilege.Whitelisted]: 'Whitelisted',
[UserPrivilege.Alumni]: 'Alumni',
[UserPrivilege.TournamentStuff]: 'TournamentStuff',
[UserPrivilege.ChannelModerator]: 'ChannelModerator',
[UserPrivilege.Moderator]: 'Moderator',
[UserPrivilege.BeatmapNominator]: 'BeatmapNominator',
[UserPrivilege.Staff]: 'Staff',
[UserPrivilege.Admin]: '管理员',
[UserPrivilege.Owner]: 'Owner',
[UserPrivilege.Bot]: 'Bot',
},
scope: {
[Scope.Self]: '',
[Scope.Friends]: '',
[Scope.Public]: '',
[Scope.Self]: '自己',
[Scope.Friends]: '仅好友',
[Scope.Public]: '公开',
},
} satisfies GlobalI18n as GlobalI18n
48 changes: 38 additions & 10 deletions src/pages/article/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,34 @@ async function postFetch() {
}
</script>

<i18n lang="yaml">
en-GB:
editing: Editing
load: Load
new: New
save: Save
delete: Delete
import: Import
export: Export
dynamic-content: Dynamic Content
read-access: Read Access
write-access: Write Access
selecting: select

zh-CN:
editing: 正在编辑
load: 载入
new: 新建
save: 保存
delete: 删除
import: 导入
export: 导出
dynamic-content: 允许动态内容
read-access: 访问权限
write-access: 写入权限
selecting: 请选择
</i18n>

<template>
<section class="container pb-8 mx-auto custom-container lg:px-2">
<div class="flex">
Expand All @@ -157,54 +185,54 @@ async function postFetch() {
<div class="divider-horizontal divider" />
<div>
<div class="flex gap-2 items-baseline">
Editing: <input
{{ t('editing') }}: <input
v-model="article.slug" type="text" class="input input-sm shadow-lg" :class="{
'input-error': !article.slug,
}"
>
<button class="btn btn-sm btn-info" @click="() => { update(); postFetch() }">
Load
{{ t('load') }}
</button>
<button class="btn btn-sm btn-primary" @click="() => { create(); postFetch() }">
New
{{ t('new') }}
</button>
<button
class="btn btn-sm btn-success" :class="{
'btn-disabled': !(article.slug && article.json),
}" @click="() => { save(); postFetch() }"
>
Save
{{ t('save') }}
</button>
<div class="divider divider-horizontal" />
<button
class="btn btn-sm btn-error" :class="{
'btn-disabled': !(article.slug && access?.write),
}" @click="() => { del().then(postFetch) }"
>
Delete
{{ t('delete') }}
</button>
<div class="divider divider-horizontal" />
<input ref="importArticleFile" type="file" hidden @change="importArticle">
<button class="btn btn-sm btn-primary" @click="importArticleFile?.click">
Import
{{ t('import') }}
</button>
<button class="btn btn-sm btn-secondary" @click="exportArticle">
Export
{{ t('export') }}
</button>
</div>
<div class="divider" />
<div class="flex flex-col md:flex-row gap-3 flex-wrap">
<div class="form-control flex-row items-center gap-2">
<input v-model="article.dynamic" class="checkbox" type="checkbox">
<label class="label">Dynamic Content</label>
<label class="label">{{ t('dynamic-content') }}</label>
</div>
<div class="divider divider-horizontal" />
<div class="form-control flex-row items-center gap-2">
<label class="label pl-0">Read Access</label>
<label class="label pl-0">{{ t('read-access') }}</label>
<t-multi-select v-model="article.privilege.read" size="sm" :options="options(readPrivileges)" />
</div>
<div class="form-control flex-row items-center gap-2">
<label class="label">Write Access</label>
<label class="label">{{ t('write-access') }}</label>
<t-multi-select v-model="article.privilege.write" size="sm" :options="options(privileges)" />
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/pages/auth/logout.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts" setup>
// old is '~/store/session'
import { useSession } from '~/store/session'
definePageMeta ({
Expand Down
14 changes: 11 additions & 3 deletions src/pages/me/relations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ useHead({
titleTemplate: `Friends - ${config.title}`,
})
if (!relations.value) {
throw new Error('user not exists')
throw new Error(t('user-not-found'))
}
const errorMessage = shallowRef('')
onErrorCaptured((err) => {
errorMessage.value = err.message || 'something went wrong.'
errorMessage.value = err.message || t('err-message')
})
function haveRelation(relation: Relationship, user: UserEssential<string> & UserRelationship) {
return user.relationship.includes(relation)
Expand Down Expand Up @@ -62,8 +62,16 @@ const isFriend = haveRelation.bind(null, Relationship.Friend)
<i18n lang="yaml">
en-GB:
loading: Loading...
err-message: something went wrong.
user-not-found: user not exists
remove-friend: remove friend
regret: regret
zh-CN:
loading: 加载中...
err-message: 出现了些小问题。
user-not-found: 该用户不存在
remove-friend: 删除该好友
regret: 后悔了
</i18n>

<template>
Expand Down Expand Up @@ -111,7 +119,7 @@ zh-CN:
chat
</t-button> -->
<t-button :loading="pendingUser.has(user.id)" variant="warning" size="xs" class="md:btn-sm" @click="toggleFriend(user)">
{{ pendingUser.has(user.id) ? '' : isFriend(user) ? 'remove friend' : 'regret' }}
{{ pendingUser.has(user.id) ? '' : isFriend(user) ? t('remove-friend') : t('regret') }}
</t-button>
<!-- <t-button :loading="pendingUser.has(user.id)" variant="warning" size="xs" class="md:btn-sm" @click="toggleBlock(user)">
{{ pendingUser.has(user.id) ? '' : isBlocked(user) ? 'remove block' : 'regret' }}
Expand Down
6 changes: 4 additions & 2 deletions src/pages/me/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ en-GB:
ready: Save

avatar:
change: change
size-too-big: size too big
upload:
click-to-upload: click-to-upload
Expand Down Expand Up @@ -270,9 +271,10 @@ zh-CN:

status:
done: 完成
save: 保存
ready: 保存

avatar:
change: 更换头像
size-too-big: 图片大小过大,请控制在2MB以内
upload:
click-to-upload: 点击此处上传
Expand Down Expand Up @@ -498,7 +500,7 @@ zh-CN:
@click="() => changeAvatar?.showModal()"
>
<icon name="ic:round-edit-note" class="w-5 h-5" size="100%" />
change
{{ t('avatar.change') }}
</button>
<img
:src="newAvatarURL || `${user.avatarSrc}`"
Expand Down

0 comments on commit 9791fc5

Please sign in to comment.