Cat-Printer/www/i18n.d.ts

40 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

type DictOf<T> = { [key: string]: T };
type Conditions = DictOf<string>;
type ConditionsOf<K extends Languages> = AllConditions[K];
type LanguageData = DictOf<Conditions | string>;
type Things = { [index: number | string]: number | string | boolean | null } | Array<number | string>;
interface Extension {
(things: Things, conditions: Conditions): string;
}
interface ExtensionOf<K extends Languages> {
(things: Things, conditions: ConditionsOf<K> | string): string;
}
type Languages = keyof AllConditions;
/**
* All known possible condition keys, per language
× These are what will be used in langauge files
* Please add more as you do in extensions
*/
type AllConditions = {
'en-US': {
'single': string,
'multiple': string,
'nth': string,
'a': string,
'an': string
},
'de-DE': {
'single': string,
'multiple': string
},
'zh-CN': {
'measure': string
}
};
interface I18nCallable extends I18n {
(text: string, things: Things, can_change_things: boolean): string;
}