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

[i18n] provide localizations for discord command description #198

Merged
merged 6 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
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
Loading