Skip to content

Commit 05ea4c5

Browse files
committed
refactor: better translations
1 parent cb591fe commit 05ea4c5

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

apps/web/src/components/filtered-posts.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const FilteredPosts = (props: FilteredPostsProps) => {
3030
onChange={(e) => {
3131
setSearchValue(e.target.value)
3232
}}
33-
placeholder={t('component.filtered-posts.placeholder')}
34-
aria-label={t('component.filtered-posts.placeholder')}
33+
placeholder={t('components.filtered-posts.placeholder')}
34+
aria-label={t('components.filtered-posts.placeholder')}
3535
className='w-full pl-12'
3636
id='search'
3737
/>
@@ -40,7 +40,7 @@ const FilteredPosts = (props: FilteredPostsProps) => {
4040
</Label>
4141
</div>
4242
{filteredPosts.length === 0 && (
43-
<div className='my-24 text-center text-xl'>{t('component.filtered-posts.no-posts-found')}</div>
43+
<div className='my-24 text-center text-xl'>{t('components.filtered-posts.no-posts-found')}</div>
4444
)}
4545
<PostCards posts={filteredPosts} />
4646
</>

apps/web/src/components/go-to-homepage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const GoToHomepage = () => {
99

1010
return (
1111
<Link href='/' className={buttonVariants()}>
12-
{t('component.go-to-homepage')}
12+
{t('components.go-to-homepage')}
1313
</Link>
1414
)
1515
}

apps/web/src/components/home/selected-projects.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const SelectedProjects = (props: SelectedProjectsProps) => {
6262
duration: 0.3
6363
}}
6464
>
65-
{t('homepage.selectedProjects.title')}
65+
{t('homepage.selected-projects.title')}
6666
</motion.h2>
6767
<motion.div
6868
className='mt-12 grid gap-4 md:grid-cols-2'
@@ -92,7 +92,7 @@ const SelectedProjects = (props: SelectedProjectsProps) => {
9292
'rounded-xl'
9393
)}
9494
>
95-
{t('homepage.selectedProjects.more')}
95+
{t('homepage.selected-projects.more')}
9696
</Link>
9797
</div>
9898
</motion.div>
@@ -109,7 +109,7 @@ const Card = (props: CardProps) => {
109109
<div className='flex items-center justify-between p-4'>
110110
<div className='flex items-center gap-3'>
111111
<LightbulbIcon className='size-4.5' />
112-
<h2>{t('homepage.selectedProjects.card')}</h2>
112+
<h2>{t('homepage.selected-projects.card')}</h2>
113113
</div>
114114
<ArrowUpRightIcon className='size-4.5 opacity-0 transition-opacity group-hover:opacity-100' />
115115
</div>

apps/web/src/hooks/use-copy-to-clipboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const useCopyToClipboard = (): [(options: CopyOptions) => Promise<void>,
1919
try {
2020
await navigator.clipboard.writeText(text)
2121
setIsCopied(true)
22-
toast.success(successMessage ?? t('hook.copy-to-clipboard.copied'))
22+
toast.success(successMessage ?? t('hooks.copy-to-clipboard.copied'))
2323

2424
setTimeout(() => {
2525
setIsCopied(false)

packages/i18n/src/messages/en.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"display-name": "Display name",
1313
"edit-name": "Edit name",
1414
"edit-name-description": "Change your display name. This name will be shown on your profile and comments.",
15-
"edit-name-successfully": "Edit name successfully",
15+
"edit-name-successfully": "Display name updated successfully",
1616
"email": "Email",
1717
"no-active-sessions": "No active sessions",
1818
"profile": "Profile",
@@ -35,7 +35,7 @@
3535
},
3636
"auth": {
3737
"sign-out-failed": "Sign out failed. Please try again.",
38-
"sign-out-successfully": "Sign out successfully"
38+
"sign-out-successfully": "Signed out successfully"
3939
},
4040
"blog": {
4141
"comments": {
@@ -131,7 +131,7 @@
131131
"unknown": "Unknown",
132132
"views": "{count, plural, =1 {# view} other {# views}}"
133133
},
134-
"component": {
134+
"components": {
135135
"filtered-posts": {
136136
"no-posts-found": "No posts found",
137137
"placeholder": "Search articles"
@@ -160,7 +160,7 @@
160160
},
161161
"error": {
162162
"comment-cannot-be-empty": "Comment cannot be empty",
163-
"copy-to-clipboard-error": "Unable to copy to clipboard. Please try again!",
163+
"copy-to-clipboard-error": "Unable to copy to clipboard. Please try again.",
164164
"failed-to-fetch-comments-data": "Failed to fetch comments data. Please refresh the page.",
165165
"failed-to-fetch-users-data": "Failed to fetch users data. Please refresh the page.",
166166
"failed-to-load": "Failed to load.",
@@ -172,16 +172,16 @@
172172
"name-cannot-be-empty": "Name cannot be empty",
173173
"name-too-long": "Name is too long",
174174
"need-logged-in-to-vote": "You need to be logged in to vote comments",
175-
"not-found": "Page Not Found!",
175+
"not-found": "Page not found.",
176176
"now-playing-error": "Failed to fetch Spotify data",
177177
"reply-cannot-be-empty": "Reply cannot be empty",
178178
"sign-in-error": "Failed to sign in. Please try again.",
179-
"something-went-wrong": "Something went wrong!",
179+
"something-went-wrong": "Something went wrong. Please try again.",
180180
"try-again": "Try again"
181181
},
182182
"guestbook": {
183-
"create-message-successfully": "Create message successfully",
184-
"delete-message-successfully": "Delete message successfully",
183+
"create-message-successfully": "Message created successfully",
184+
"delete-message-successfully": "Message deleted successfully",
185185
"description": "Sign my guestbook and share your idea. You can tell me anything here!",
186186
"no-messages": "No messages. Be the first to leave a message!",
187187
"pinned": {
@@ -225,21 +225,21 @@
225225
"more": "See all articles",
226226
"title": "Latest Articles"
227227
},
228-
"selectedProjects": {
228+
"selected-projects": {
229229
"card": "Project",
230-
"more": "See all project",
230+
"more": "See all projects",
231231
"title": "Selected Projects"
232232
}
233233
},
234-
"hook": {
234+
"hooks": {
235235
"copy-to-clipboard": {
236-
"copied": "Copied to clipboard!"
236+
"copied": "Copied to clipboard"
237237
}
238238
},
239239
"layout": {
240240
"change-language": "Change language",
241241
"now-playing": {
242-
"loading": "Loading ...",
242+
"loading": "Loading...",
243243
"not-listening": "Not Listening - Spotify"
244244
},
245245
"skip-to-main-content": "Skip to main content",

packages/i18n/src/messages/zh-CN.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"unknown": "未知",
132132
"views": "{count, plural, =1 {# 浏览次数} other {# 浏览次数}}"
133133
},
134-
"component": {
134+
"components": {
135135
"filtered-posts": {
136136
"no-posts-found": "没有找到文章",
137137
"placeholder": "搜寻文章"
@@ -160,7 +160,7 @@
160160
},
161161
"error": {
162162
"comment-cannot-be-empty": "评论不能为空",
163-
"copy-to-clipboard-error": "无法复制到剪贴板请再试一次",
163+
"copy-to-clipboard-error": "无法复制到剪贴板请再试一次",
164164
"failed-to-fetch-comments-data": "无法获取评论数据。请刷新页面。",
165165
"failed-to-fetch-users-data": "无法获取用户数据。请刷新页面。",
166166
"failed-to-load": "无法载入。",
@@ -172,11 +172,11 @@
172172
"name-cannot-be-empty": "名称不能为空",
173173
"name-too-long": "名称过长",
174174
"need-logged-in-to-vote": "您必须登入才能投票评论",
175-
"not-found": "找不到页面",
175+
"not-found": "找不到页面",
176176
"now-playing-error": "无法获取 Spotify 资料",
177177
"reply-cannot-be-empty": "回复不能为空",
178178
"sign-in-error": "登入失败。请再试一次。",
179-
"something-went-wrong": "出了一些问题!",
179+
"something-went-wrong": "发生了一些问题,请再试一次。",
180180
"try-again": "再试一次"
181181
},
182182
"guestbook": {
@@ -225,21 +225,21 @@
225225
"more": "查看所有文章",
226226
"title": "最新文章"
227227
},
228-
"selectedProjects": {
228+
"selected-projects": {
229229
"card": "项目",
230230
"more": "查看所有项目",
231231
"title": "精选项目"
232232
}
233233
},
234-
"hook": {
234+
"hooks": {
235235
"copy-to-clipboard": {
236-
"copied": "已复制到剪贴板"
236+
"copied": "已复制到剪贴板"
237237
}
238238
},
239239
"layout": {
240240
"change-language": "更改语言",
241241
"now-playing": {
242-
"loading": "载入中 ...",
242+
"loading": "载入中...",
243243
"not-listening": "未在收听 - Spotify"
244244
},
245245
"skip-to-main-content": "跳至主要内容",

packages/i18n/src/messages/zh-TW.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"unknown": "未知",
132132
"views": "{count, plural, =1 {# 瀏覽次數} other {# 瀏覽次數}}"
133133
},
134-
"component": {
134+
"components": {
135135
"filtered-posts": {
136136
"no-posts-found": "沒有找到文章",
137137
"placeholder": "搜尋文章"
@@ -160,7 +160,7 @@
160160
},
161161
"error": {
162162
"comment-cannot-be-empty": "評論不能為空",
163-
"copy-to-clipboard-error": "無法複製到剪貼簿請再試一次",
163+
"copy-to-clipboard-error": "無法複製到剪貼簿請再試一次",
164164
"failed-to-fetch-comments-data": "無法獲取評論資料。請重新整理頁面。",
165165
"failed-to-fetch-users-data": "無法獲取使用者資料。請重新整理頁面。",
166166
"failed-to-load": "無法載入。",
@@ -172,11 +172,11 @@
172172
"name-cannot-be-empty": "名稱不能為空",
173173
"name-too-long": "名稱過長",
174174
"need-logged-in-to-vote": "您必須登入才能投票評論",
175-
"not-found": "找不到頁面",
175+
"not-found": "找不到頁面",
176176
"now-playing-error": "無法獲取 Spotify 資料",
177177
"reply-cannot-be-empty": "回覆不能為空",
178178
"sign-in-error": "登入失敗。請再試一次。",
179-
"something-went-wrong": "出了一些問題!",
179+
"something-went-wrong": "發生了一些問題,請再試一次。",
180180
"try-again": "再試一次"
181181
},
182182
"guestbook": {
@@ -225,21 +225,21 @@
225225
"more": "查看所有文章",
226226
"title": "最新文章"
227227
},
228-
"selectedProjects": {
228+
"selected-projects": {
229229
"card": "專案",
230230
"more": "查看所有專案",
231231
"title": "精選專案"
232232
}
233233
},
234-
"hook": {
234+
"hooks": {
235235
"copy-to-clipboard": {
236-
"copied": "已複製到剪貼簿"
236+
"copied": "已複製到剪貼簿"
237237
}
238238
},
239239
"layout": {
240240
"change-language": "更改語言",
241241
"now-playing": {
242-
"loading": "載入中 ...",
242+
"loading": "載入中...",
243243
"not-listening": "未在收聽 - Spotify"
244244
},
245245
"skip-to-main-content": "跳至主要內容",

0 commit comments

Comments
 (0)