Skip to content

Commit

Permalink
[i18n] provide localizations for discord command description (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonNekoGH committed Apr 1, 2024
1 parent 26ca70f commit 1b419ca
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
2 changes: 1 addition & 1 deletion internal/bots/discord/listeners/listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (b *Listeners) smrCmd(event *events.ApplicationCommandInteractionCreate, da

b.logger.Info(fmt.Sprintf("discord: command received: /smr %s", urlString))

lang := event.Locale().String()
lang := event.Locale().Code()

// url check
err, originErr := smr.CheckUrl(urlString)
Expand Down
24 changes: 12 additions & 12 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ system:

modules:
telegram:
chatMigration:
chatMigration: ''
notification: |
{{.Name}} @{{.Username}} has observed your group's upgrading to a <b>supergroup</b>, where the group ID will change. Rest assured, we've smoothly transitioned all historical data to the new group ID, while maintaining all your settings unaltered. However, due to Telegram's limitations, message IDs from before the upgrade won't match those sent after and will thus be excluded from future summaries. We regret any inconvenience caused by such migrations.
Expand Down Expand Up @@ -69,17 +69,17 @@ commands:
commands:
smr:
help: Enhance your article reading with Quantum Speed-Reading. This feature enables rapid understanding of web content and is compatible across messaging platforms. Initiate with :/smr <code>&lt;link&gt;</code>.
noLinksFound:
telegram: No link detected. Please provide a valid URL to proceed. Example usage:<code>/smr &lt;link&gt;</code>.
slackOrDiscord: No link detected. Please provide a valid URL to proceed. Example usage:`/smr <link>`.
invalidLink:
telegram: The link provided could not be processed. Please ensure the URL is correct and try again. Usage:<code>/smr &lt;link&gt;</code>.
slackOrDiscord: The link provided could not be processed. Please ensure the URL is correct and try again. Usage:`/smr <link>`.
reading: Quantum Speed-Reading is currently processing your request, please wait...
rateLimitExceeded: Apologies, but you've reached the rate limit to maintain service stability. This command is accessible once every {{ .Seconds }} seconds. Kindly wait {{ .SecondsToBeWaited }} seconds before attempting again. We appreciate your patience and comprehension.
failedToRead: Quantum Speed-Reading was unsuccessful. Would you like to retry?
failedToReadDueToFailedToFetch: Encountered an issue retrieving the content for Quantum Speed-Reading. Perhaps another attempt might succeed?
contentNotSupported: This content is not supported by Quantum Speed-Reading. Considering another link might be beneficial.
noLinksFound:
telegram: No link detected. Please provide a valid URL to proceed. Example usage:<code>/smr &lt;link&gt;</code>.
slackOrDiscord: No link detected. Please provide a valid URL to proceed. Example usage:`/smr <link>`.
invalidLink:
telegram: The link provided could not be processed. Please ensure the URL is correct and try again. Usage:<code>/smr &lt;link&gt;</code>.
slackOrDiscord: The link provided could not be processed. Please ensure the URL is correct and try again. Usage:`/smr <link>`.
reading: Quantum Speed-Reading is currently processing your request, please wait...
rateLimitExceeded: Apologies, but you've reached the rate limit to maintain service stability. This command is accessible once every {{ .Seconds }} seconds. Kindly wait {{ .SecondsToBeWaited }} seconds before attempting again. We appreciate your patience and comprehension.
failedToRead: Quantum Speed-Reading was unsuccessful. Would you like to retry?
failedToReadDueToFailedToFetch: Encountered an issue retrieving the content for Quantum Speed-Reading. Perhaps another attempt might succeed?
contentNotSupported: This content is not supported by Quantum Speed-Reading. Considering another link might be beneficial.

prompts:
smr:
Expand Down
21 changes: 18 additions & 3 deletions pkg/bots/discordbot/commanddef.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,26 @@ var commands = []discord.ApplicationCommandCreate{
discord.SlashCommandCreate{
Name: "smr",
Description: "对网页进行总结",
DescriptionLocalizations: map[discord.Locale]string{
discord.LocaleChineseCN: "对网页进行总结",
discord.LocaleEnglishUS: "Summarize a web article",
discord.LocaleEnglishGB: "Summarize a web article",
},
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionString{
Required: true,
Name: "link",
Description: "网页链接",
Required: true,
Name: "link",
NameLocalizations: map[discord.Locale]string{
discord.LocaleChineseCN: "文章链接",
discord.LocaleEnglishUS: "link",
discord.LocaleEnglishGB: "link",
},
Description: "The link of web article",
DescriptionLocalizations: map[discord.Locale]string{
discord.LocaleChineseCN: "需要被总结的文章的链接",
discord.LocaleEnglishUS: "The link of web article",
discord.LocaleEnglishGB: "The link of web article",
},
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/linkprev/linkprev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func TestPreview(t *testing.T) {
Title: "Nólëbase | 记录回忆,知识和畅想的地方",
Description: "记录回忆,知识和畅想的地方",
Favicon: "/logo.svg",
Author: "Ayaka Neko, Ayaka Rizumu",
Author: "絢香猫, 絢香音",
Keywords: []string{
"markdown, knowledgebase, 知识库, vitepress, obsidian, notebook, notes, nekomeowww, littlesound",
"markdown, knowledge-base, 知识库, vitepress, obsidian, notebook, notes, nekomeowww, LittleSound",
},
OpenGraph: opengraph.OpenGraph{
Title: "Nólëbase",
Expand Down

0 comments on commit 1b419ca

Please sign in to comment.