Commit 96f15dfb authored by nanahira's avatar nanahira

put @DefineLocale universal

parent 5a87ea40
...@@ -221,8 +221,21 @@ export const DefineTemplate = (name: string, text: string | Dict<string>) => ...@@ -221,8 +221,21 @@ export const DefineTemplate = (name: string, text: string | Dict<string>) =>
registerTemplate({ name, text: adaptLocaleDict(text) }, ctx), registerTemplate({ name, text: adaptLocaleDict(text) }, ctx),
); );
export const DefineLocale = ( type Node = string | Store;
export function DefineLocale(locale: string, dict: Store): ClassDecorator;
export function DefineLocale(
locale: string, locale: string,
key: string, key: string,
text: string | Store, value: Node,
) => TopLevelAction((ctx) => ctx.i18n.define(locale, key, text)); ): ClassDecorator;
export function DefineLocale(
locale: string,
...args: [Store] | [string, Node]
): ClassDecorator {
return TopLevelAction((ctx) =>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
ctx.i18n.define(locale, ...args),
);
}
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