Skip to content

Commit

Permalink
refa: migrate konachan schema to i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan committed Aug 14, 2024
1 parent c2cdf53 commit b68bc16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/konachan/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,18 @@ namespace KonachanImageSource {
ImageSource.createSchema({ label: 'konachan' }),
Schema.object({
endpoint: Schema.union([
Schema.const('https://konachan.com/').description('Konachan.com (NSFW)'),
Schema.const('https://konachan.net/').description('Konachan.net (SFW)'),
])
.description('Konachan 的 URL。')
.default('https://konachan.com/'),
Schema.const('https://konachan.com/'),
Schema.const('https://konachan.net/'),
]).default('https://konachan.com/'),
keyPairs: Schema.array(
Schema.object({
login: Schema.string().required().description('用户名'),
password: Schema.string().required().role('secret').description('密码'),
login: Schema.string().required(),
password: Schema.string().required().role('secret'),
}),
)
.default([])
.description('Konachan 的登录凭据。'),
}).description('搜索设置'),
).default([]),
}).i18n({
'zh-CN': require('./locales/zh-CN.schema'),
}),
])
}

Expand Down
11 changes: 11 additions & 0 deletions packages/konachan/src/locales/zh-CN.schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$description: 搜索设置
endpoint:
$description: Konachan 的 URL。
$inner:
- Konachan.com (NSFW)
- Konachan.net (SFW)
keyPairs:
$description: Konachan 的登录凭据。
$inner:
login: 用户名
password: 密码

0 comments on commit b68bc16

Please sign in to comment.