Skip to content

Commit 2a36b73

Browse files
authored
fix(i18n): update zh-CN translations & localize error page (#1755)
1 parent 3a5d256 commit 2a36b73

File tree

9 files changed

+133
-13
lines changed

9 files changed

+133
-13
lines changed

app/components/Package/TrendsChart.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,8 @@ const chartConfig = computed<VueUiXyConfig>(() => {
14951495
annotator: $t('package.trends.toggle_annotator'),
14961496
stack: $t('package.trends.toggle_stack_mode'),
14971497
altCopy: $t('package.trends.copy_alt.button_label'), // Do not make this text dependant on the `copied` variable, since this would re-render the component, which is undesirable if the minimap was used to select a time frame.
1498+
open: $t('package.trends.open_options'),
1499+
close: $t('package.trends.close_options'),
14981500
},
14991501
callbacks: {
15001502
img: args => {

app/components/Package/VersionDistribution.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ const chartConfig = computed<VueUiXyConfig>(() => {
201201
svg: $t('package.trends.download_file', { fileType: 'SVG' }),
202202
annotator: $t('package.trends.toggle_annotator'),
203203
altCopy: $t('package.trends.copy_alt.button_label'), // Do not make this text dependant on the `copied` variable, since this would re-render the component, which is undesirable if the minimap was used to select a time frame.
204+
open: $t('package.trends.open_options'),
205+
close: $t('package.trends.close_options'),
204206
},
205207
callbacks: {
206208
img: args => {

app/error.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ const props = defineProps<{
55
error: NuxtError
66
}>()
77
8-
const status = computed(() => props.error.statusCode || 500)
8+
const status = computed(() => props.error.status || 500)
99
const statusText = computed(() => {
10-
if (props.error.statusMessage) return props.error.statusMessage
10+
if (props.error.statusText) return props.error.statusText
1111
switch (status.value) {
1212
case 401:
13-
return 'Unauthorized'
13+
return $t('error.401')
1414
case 404:
15-
return 'Page not found'
15+
return $t('error.404')
1616
case 500:
17-
return 'Internal server error'
17+
return $t('error.500')
1818
case 503:
19-
return 'Service unavailable'
19+
return $t('error.503')
2020
default:
21-
return 'Something went wrong'
21+
return $t('error.default')
2222
}
2323
})
2424

i18n/locales/en.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@
122122
"edit_on_github": "Edit on GitHub",
123123
"view_guide": "Translation guide"
124124
},
125+
"error": {
126+
"401": "Unauthorized",
127+
"404": "Page not found",
128+
"500": "Internal server error",
129+
"503": "Service unavailable",
130+
"default": "Something went wrong"
131+
},
125132
"common": {
126133
"loading": "Loading...",
127134
"loading_more": "Loading more...",
@@ -399,6 +406,8 @@
399406
"download_file": "Download {fileType}",
400407
"toggle_annotator": "Toggle annotator",
401408
"toggle_stack_mode": "Toggle stack mode",
409+
"open_options": "Open options",
410+
"close_options": "Close options",
402411
"legend_estimation": "Estimation",
403412
"no_data": "No data available",
404413
"y_axis_label": "{granularity} {facet}",

i18n/locales/zh-CN.json

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@
122122
"edit_on_github": "在 GitHub 上编辑",
123123
"view_guide": "翻译指南"
124124
},
125+
"error": {
126+
"401": "未授权",
127+
"404": "很抱歉,页面未找到",
128+
"500": "服务器内部错误",
129+
"503": "服务不可用",
130+
"default": "抱歉,出现了一些问题"
131+
},
125132
"common": {
126133
"loading": "加载中…",
127134
"loading_more": "加载更多中…",
@@ -144,7 +151,28 @@
144151
"role": "角色",
145152
"members": "成员"
146153
},
147-
"scroll_to_top": "回到顶部"
154+
"scroll_to_top": "回到顶部",
155+
"cancel": "取消",
156+
"save": "保存",
157+
"edit": "编辑",
158+
"error": "加载出错"
159+
},
160+
"profile": {
161+
"display_name": "显示名称",
162+
"description": "简介",
163+
"no_description": "暂无简介",
164+
"website": "网站",
165+
"website_placeholder": "https://example.com",
166+
"likes": "喜欢",
167+
"seo_title": "{handle} - npmx",
168+
"seo_description": "{handle} 的 npmx 个人资料",
169+
"not_found": "未找到个人资料",
170+
"not_found_message": "找不到 {handle} 的个人资料。",
171+
"invite": {
172+
"message": "看起来他们还没有使用 npmx,去邀请一下?",
173+
"share_button": "分享到 Bluesky",
174+
"compose_text": "嗨 {'@'}{handle}!您用过 npmx.dev 吗?它是一个快速、现代且开源的 npm registry 浏览器。\nhttps://npmx.dev"
175+
}
148176
},
149177
"package": {
150178
"not_found": "未找到包",
@@ -378,6 +406,8 @@
378406
"download_file": "下载 {fileType}",
379407
"toggle_annotator": "切换标注工具",
380408
"toggle_stack_mode": "切换堆叠模式",
409+
"open_options": "展开选项",
410+
"close_options": "收起选项",
381411
"legend_estimation": "估算值",
382412
"no_data": "无可用数据",
383413
"y_axis_label": "{granularity} {facet}",
@@ -879,7 +909,7 @@
879909
"governance": "治理",
880910
"role_steward": "管理者",
881911
"role_maintainer": "维护者",
882-
"sponsor": "赞助者",
912+
"sponsor": "赞助",
883913
"sponsor_aria": "在 GitHub 上赞助 {name}"
884914
},
885915
"contributors": {
@@ -933,7 +963,8 @@
933963
"connect_bluesky": "使用 Bluesky 账户登录",
934964
"what_is_atmosphere": "什么是 Atmosphere 账户?",
935965
"atmosphere_explanation": "{npmx} 使用 {atproto} 为其多项社交功能提供支持,让用户真正拥有自己的数据并使用一个账户登录所有兼容的应用。一旦创建账户,你便可以使用其他应用,例如 {bluesky} 和 {tangled}。",
936-
"default_input_error": "请输入有效的 handle、DID 或完整的 PDS URL"
966+
"default_input_error": "请输入有效的 handle、DID 或完整的 PDS URL",
967+
"profile": "个人资料"
937968
}
938969
},
939970
"header": {

i18n/schema.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,27 @@
370370
},
371371
"additionalProperties": false
372372
},
373+
"error": {
374+
"type": "object",
375+
"properties": {
376+
"401": {
377+
"type": "string"
378+
},
379+
"404": {
380+
"type": "string"
381+
},
382+
"500": {
383+
"type": "string"
384+
},
385+
"503": {
386+
"type": "string"
387+
},
388+
"default": {
389+
"type": "string"
390+
}
391+
},
392+
"additionalProperties": false
393+
},
373394
"common": {
374395
"type": "object",
375396
"properties": {
@@ -1201,6 +1222,12 @@
12011222
"toggle_stack_mode": {
12021223
"type": "string"
12031224
},
1225+
"open_options": {
1226+
"type": "string"
1227+
},
1228+
"close_options": {
1229+
"type": "string"
1230+
},
12041231
"legend_estimation": {
12051232
"type": "string"
12061233
},

lunaria/files/en-GB.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@
121121
"edit_on_github": "Edit on GitHub",
122122
"view_guide": "Translation guide"
123123
},
124+
"error": {
125+
"401": "Unauthorized",
126+
"404": "Page not found",
127+
"500": "Internal server error",
128+
"503": "Service unavailable",
129+
"default": "Something went wrong"
130+
},
124131
"common": {
125132
"loading": "Loading...",
126133
"loading_more": "Loading more...",
@@ -398,6 +405,8 @@
398405
"download_file": "Download {fileType}",
399406
"toggle_annotator": "Toggle annotator",
400407
"toggle_stack_mode": "Toggle stack mode",
408+
"open_options": "Open options",
409+
"close_options": "Close options",
401410
"legend_estimation": "Estimation",
402411
"no_data": "No data available",
403412
"y_axis_label": "{granularity} {facet}",

lunaria/files/en-US.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@
121121
"edit_on_github": "Edit on GitHub",
122122
"view_guide": "Translation guide"
123123
},
124+
"error": {
125+
"401": "Unauthorized",
126+
"404": "Page not found",
127+
"500": "Internal server error",
128+
"503": "Service unavailable",
129+
"default": "Something went wrong"
130+
},
124131
"common": {
125132
"loading": "Loading...",
126133
"loading_more": "Loading more...",
@@ -398,6 +405,8 @@
398405
"download_file": "Download {fileType}",
399406
"toggle_annotator": "Toggle annotator",
400407
"toggle_stack_mode": "Toggle stack mode",
408+
"open_options": "Open options",
409+
"close_options": "Close options",
401410
"legend_estimation": "Estimation",
402411
"no_data": "No data available",
403412
"y_axis_label": "{granularity} {facet}",

lunaria/files/zh-CN.json

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@
121121
"edit_on_github": "在 GitHub 上编辑",
122122
"view_guide": "翻译指南"
123123
},
124+
"error": {
125+
"401": "未授权",
126+
"404": "很抱歉,页面未找到",
127+
"500": "服务器内部错误",
128+
"503": "服务不可用",
129+
"default": "抱歉,出现了一些问题"
130+
},
124131
"common": {
125132
"loading": "加载中…",
126133
"loading_more": "加载更多中…",
@@ -143,7 +150,28 @@
143150
"role": "角色",
144151
"members": "成员"
145152
},
146-
"scroll_to_top": "回到顶部"
153+
"scroll_to_top": "回到顶部",
154+
"cancel": "取消",
155+
"save": "保存",
156+
"edit": "编辑",
157+
"error": "加载出错"
158+
},
159+
"profile": {
160+
"display_name": "显示名称",
161+
"description": "简介",
162+
"no_description": "暂无简介",
163+
"website": "网站",
164+
"website_placeholder": "https://example.com",
165+
"likes": "喜欢",
166+
"seo_title": "{handle} - npmx",
167+
"seo_description": "{handle} 的 npmx 个人资料",
168+
"not_found": "未找到个人资料",
169+
"not_found_message": "找不到 {handle} 的个人资料。",
170+
"invite": {
171+
"message": "看起来他们还没有使用 npmx,去邀请一下?",
172+
"share_button": "分享到 Bluesky",
173+
"compose_text": "嗨 {'@'}{handle}!您用过 npmx.dev 吗?它是一个快速、现代且开源的 npm registry 浏览器。\nhttps://npmx.dev"
174+
}
147175
},
148176
"package": {
149177
"not_found": "未找到包",
@@ -377,6 +405,8 @@
377405
"download_file": "下载 {fileType}",
378406
"toggle_annotator": "切换标注工具",
379407
"toggle_stack_mode": "切换堆叠模式",
408+
"open_options": "展开选项",
409+
"close_options": "收起选项",
380410
"legend_estimation": "估算值",
381411
"no_data": "无可用数据",
382412
"y_axis_label": "{granularity} {facet}",
@@ -878,7 +908,7 @@
878908
"governance": "治理",
879909
"role_steward": "管理者",
880910
"role_maintainer": "维护者",
881-
"sponsor": "赞助者",
911+
"sponsor": "赞助",
882912
"sponsor_aria": "在 GitHub 上赞助 {name}"
883913
},
884914
"contributors": {
@@ -932,7 +962,8 @@
932962
"connect_bluesky": "使用 Bluesky 账户登录",
933963
"what_is_atmosphere": "什么是 Atmosphere 账户?",
934964
"atmosphere_explanation": "{npmx} 使用 {atproto} 为其多项社交功能提供支持,让用户真正拥有自己的数据并使用一个账户登录所有兼容的应用。一旦创建账户,你便可以使用其他应用,例如 {bluesky} 和 {tangled}。",
935-
"default_input_error": "请输入有效的 handle、DID 或完整的 PDS URL"
965+
"default_input_error": "请输入有效的 handle、DID 或完整的 PDS URL",
966+
"profile": "个人资料"
936967
}
937968
},
938969
"header": {

0 commit comments

Comments
 (0)