Commit 0d2fc4a5 authored by nanahira's avatar nanahira

add @CommandLocale

parent d97a6938
...@@ -114,6 +114,12 @@ export const CommandUse = <T extends Command, R extends any[]>( ...@@ -114,6 +114,12 @@ export const CommandUse = <T extends Command, R extends any[]>(
...args: R ...args: R
) => CommandDef((cmd) => callback(cmd, ...args)); ) => CommandDef((cmd) => callback(cmd, ...args));
export const CommandLocale = (locale: string, def: any) =>
CommandDef((cmd, ctx) => {
ctx.i18n.define(locale, `commands.${cmd.name}`, def);
return cmd;
});
export const CommandDescription = (desc: string | Dict<string>) => { export const CommandDescription = (desc: string | Dict<string>) => {
return CommandDef((cmd, ctx) => { return CommandDef((cmd, ctx) => {
for (const localData of Object.entries(adaptLocaleDict(desc))) { for (const localData of Object.entries(adaptLocaleDict(desc))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment