Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: some version of koishi failed to resolve scope of i18n text #228

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/core/src/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function apply(ctx: Context, config: Config) {

const filtered = images?.filter((image) => config.nsfw || !image.nsfw)

if (!filtered?.length) return session?.text('.no-result')
if (!filtered?.length) return session?.text('commands.booru.messages.no-result')

const output: Element[][] = []

Expand All @@ -86,13 +86,13 @@ export function apply(ctx: Context, config: Config) {
if (config.asset && ctx.assets) {
url = await ctx.booru.imgUrlToAssetUrl(url)
if (!url) {
children.unshift(<i18n path='.no-image'></i18n>)
children.unshift(<i18n path='commands.booru.messages.no-image'></i18n>)
continue
}
} else if (config.base64) {
url = await ctx.booru.imgUrlToBase64(url)
if (!url) {
children.unshift(<i18n path='.no-image'></i18n>)
children.unshift(<i18n path='commands.booru.messages.no-image'></i18n>)
continue
}
}
Expand All @@ -101,10 +101,10 @@ export function apply(ctx: Context, config: Config) {
if (image.tags) {
children.unshift(
<p>
<i18n path='.output.source'>{[source]}</i18n>
<i18n path='commands.booru.messages.output.source'>{[source]}</i18n>
</p>,
<p>
<i18n path='.output.tags'>{[image.tags.join(', ')]}</i18n>
<i18n path='commands.booru.messages.output.tags'>{[image.tags.join(', ')]}</i18n>
</p>,
)
}
Expand All @@ -122,14 +122,14 @@ export function apply(ctx: Context, config: Config) {
<p>
{config.output >= OutputType.ImageAndLink && image.authorUrl ? (
<a href={image.authorUrl}>
<i18n path='.output.author'>{[image.author]}</i18n>
<i18n path='commands.booru.messages.output.author'>{[image.author]}</i18n>
</a>
) : (
<i18n path='.output.author'>{[image.author]}</i18n>
<i18n path='commands.booru.messages.output.author'>{[image.author]}</i18n>
)}
</p>,
<p>
<i18n path='.output.desc'>{[image.desc]}</i18n>
<i18n path='commands.booru.messages.output.desc'>{[image.desc]}</i18n>
</p>,
)
}
Expand Down Expand Up @@ -164,7 +164,7 @@ export function apply(ctx: Context, config: Config) {
const tip = Random.pick(tips)
output.push(
<p>
<i18n path='.tips'></i18n>
<i18n path='commands.booru.messages.tips'></i18n>
<i18n path={tip}>{[command.displayName]}</i18n>
</p>,
)
Expand Down