UNPKG

i18n-llm-translate

Version:

Automatically translates namespace-based JSON translation files across multiple languages from any source language

19 lines (18 loc) 1.1 kB
export type TranslationKey = string; export type TranslationLeaf<Value> = { [key in TranslationKey]: Value; }; export type TranslationPrimitiveValue = string | number | boolean; export type TranslationArrayValue = TranslationPrimitiveValue[]; export type TranslationTreeValue = TranslationPrimitiveValue | TranslationArrayValue | TranslationTree; export interface TranslationTree extends TranslationLeaf<TranslationTreeValue> { } export type TranslationCacheValue = TranslationLeaf<TranslationPrimitiveValue | TranslationArrayValue> & { valid: boolean; }; type TranslationWalkType = 'leaf' | 'array' | 'primitive' | 'null'; type TranslationWalker<A, B, R> = (a: A, aType: TranslationWalkType, b: B, bType: TranslationWalkType) => R; type TranslationWalkerSingle<A, R> = (value: A, type: TranslationWalkType) => R; export declare function walkTree<A, R>(tree: TranslationLeaf<A>, walker: TranslationWalkerSingle<A, R>): TranslationLeaf<R>; export declare function walkTree<A, B, R>(a: TranslationLeaf<A>, b: TranslationLeaf<B>, walker: TranslationWalker<A, B, R>): TranslationLeaf<R>; export {};