Skip to content

Commit 1c237e9

Browse files
committed
rework i18n
1 parent 845c890 commit 1c237e9

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/lib/internationalization/locales/en.cts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ export = {
268268
"Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page",
269269
help_cname:
270270
"Set the CNAME file text, it's useful for custom domains on GitHub Pages",
271-
help_favicon:
272-
"Path to a .ico, .png or .svg file to include as the site icon",
271+
help_favicon: "Path to favicon to include as the site icon",
273272
help_sourceLinkExternal:
274273
"Specifies that source links should be treated as external links to be opened in a new tab",
275274
help_markdownLinkExternal:
@@ -388,8 +387,8 @@ export = {
388387
"hostedBaseUrl must start with http:// or https://",
389388
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl:
390389
"The useHostedBaseUrlForAbsoluteLinks option requires that hostedBaseUrl be set",
391-
favicon_must_be_ico_or_svg:
392-
"Favicon file must be either a .ico, .png or .svg",
390+
favicon_must_have_one_of_the_following_extensions_0:
391+
"Favicon must have on of the following extensions: {0}",
393392
option_0_must_be_an_object: "The '{0}' option must be a non-array object",
394393
option_0_must_be_a_function: "The '{0}' option must be a function",
395394
option_0_must_be_object_with_urls: `{0} must be an object with string labels as keys and URL values`,

src/lib/internationalization/locales/zh.cts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export = localeUtils.buildIncompleteTranslation({
279279
help_readme:
280280
"应显示在索引页上的自述文件路径。传递“none”以禁用索引页并在全局页上启动文档",
281281
help_cname: "设置 CNAME 文件文本,这对于 GitHub Pages 上的自定义域很有用",
282-
help_favicon: "作为站点图标包含的 favicon.ico 或 favicon.svg 的路径",
282+
help_favicon: "作为站点图标包含的 favicon 的路径",
283283
help_sourceLinkExternal:
284284
"指定哪些源代码链接应被视为外部链接,并在新选项卡中打开",
285285
help_markdownLinkExternal:
@@ -371,7 +371,6 @@ export = localeUtils.buildIncompleteTranslation({
371371
"hostingBaseUrl 必须以 http:// 或 https:// 开头",
372372
useHostedBaseUrlForAbsoluteLinks_requires_hostedBaseUrl:
373373
"useHostedBaseUrlForAbsoluteLinks 选项要求设置 hostingBaseUrl",
374-
favicon_must_be_ico_or_svg: "Favicon 文件必须是一个 .ico 或 .svg 文件",
375374
option_0_must_be_an_object: "“{0}”选项必须是非数组对象",
376375
option_0_must_be_a_function: "‘{0}’ 选项必须是一个函数",
377376
option_0_must_be_object_with_urls:

src/lib/utils/options/sources/typedoc.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,13 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
473473
name: "favicon",
474474
help: (i18n) => i18n.help_favicon(),
475475
validate(value, i18n) {
476-
if (![".ico", ".png", ".svg"].includes(extname(value))) {
477-
throw new Error(i18n.favicon_must_be_ico_or_svg());
476+
const allowedExtension = [".ico", ".png", ".svg"];
477+
if (!allowedExtension.includes(extname(value))) {
478+
throw new Error(
479+
i18n.favicon_must_have_one_of_the_following_extensions_0(
480+
allowedExtension.join(", "),
481+
),
482+
);
478483
}
479484
},
480485
type: ParameterType.Path,

0 commit comments

Comments
 (0)