Commit a21d8fc1 authored by nanahira's avatar nanahira

add DefineLocale

parent 71c64a9e
......@@ -3,7 +3,6 @@ import {
CommandConfigExtended,
CommandDefinitionFun,
CommandOptionConfigWithDescription,
ContextFunction,
EventName,
KoishiCommandDefinition,
KoishiCommandPutDef,
......@@ -14,12 +13,12 @@ import {
import 'reflect-metadata';
import {
Argv,
Awaitable,
Command,
Dict,
FieldCollector,
Selection,
Session,
Store,
} from 'koishi';
import { Metadata } from '../meta/metadata.decorators';
import { CommandPut, DoRegister } from '../registry';
......@@ -221,3 +220,9 @@ export const DefineTemplate = (name: string, text: string | Dict<string>) =>
TopLevelAction((ctx) =>
registerTemplate({ name, text: adaptLocaleDict(text) }, ctx),
);
export const DefineLocale = (
locale: string,
key: string,
text: string | Store,
) => TopLevelAction((ctx) => ctx.i18n.define(locale, key, text));
// metadatas
import {
CommandDefinitionFun,
ContextFunction,
OnContextFunction,
TopLevelActionDef,
} from './interfaces';
import { DoRegister } from '../registry';
import { Awaitable } from 'koishi';
export const KoishiOnContextScope = 'KoishiOnContextScope';
export const KoishiDoRegister = 'KoishiDoRegister';
......
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