UNPKG

@lobehub/i18n-cli

Version:

Lobe i18n is a CLI tool that automate translate your i18n localization with AI

217 lines (213 loc) 4.62 kB
declare enum LanguageModel { /** * ChatGPT-4o */ CHATGPT_4O_LATEST = "chatgpt-4o-latest", /** * GPT-3.5 Turbo */ GPT_3_5_TURBO = "gpt-3.5-turbo", /** * GPT-3.5 Turbo 0125 */ GPT_3_5_TURBO_0125 = "gpt-3.5-turbo-0125", /** * GPT-3.5 Turbo 1106 */ GPT_3_5_TURBO_1106 = "gpt-3.5-turbo-1106", /** * GPT-4 */ GPT_4 = "gpt-4", /** * GPT-4o */ GPT_4O = "gpt-4o", /** * GPT-4o 0513 */ GPT_4O_2024_05_13 = "gpt-4o-2024-05-13", /** * GPT-4o 1120 */ GPT_4O_2024_11_20 = "gpt-4o-2024-11-20", /** * GPT-4o mini */ GPT_4O_MINI = "gpt-4o-mini", /** * GPT-4 Turbo Preview 0125 */ GPT_4_0125_PREVIEW = "gpt-4-0125-preview", /** * GPT-4 0613 */ GPT_4_0613 = "gpt-4-0613", /** * GPT-4.1 */ GPT_4_1 = "gpt-4.1", /** * GPT-4 Turbo Preview 1106 */ GPT_4_1106_PREVIEW = "gpt-4-1106-preview", /** * GPT-4.1 mini */ GPT_4_1_MINI = "gpt-4.1-mini", /** * GPT-4.1 nano */ GPT_4_1_NANO = "gpt-4.1-nano", /** * GPT-4 32K */ GPT_4_32K = "gpt-4-32k", /** * GPT-4.5 Preview */ GPT_4_5_PREVIEW = "gpt-4.5-preview", /** * GPT-4 Turbo */ GPT_4_TURBO = "gpt-4-turbo", /** * GPT-4 Turbo Vision 0409 */ GPT_4_TURBO_2024_04_09 = "gpt-4-turbo-2024-04-09", /** * GPT-4 Turbo Preview */ GPT_4_TURBO_PREVIEW = "gpt-4-turbo-preview", /** * o1 */ O1 = "o1", /** * o1-mini */ O1_MINI = "o1-mini", /** * o1-preview */ O1_PREVIEW = "o1-preview", /** * o3 */ O3 = "o3", /** * o3-mini */ O3_MINI = "o3-mini", /** * o4-mini */ O4_MINI = "o4-mini" } interface I18nConfigLocale { /** * @description Number of concurrently pending promises returned */ concurrency?: number; /** * @description The entry file or folder */ entry: string; /** * @description The language that will use as translation ref */ entryLocale: string; /** * @description ChatGPT model name to use */ modelName?: LanguageModel; /** * @description Where you store your locale files */ output: string; /** * @description All languages that need to be translated */ outputLocales: string[]; /** * @description Provide some context for a more accurate translation */ reference?: string; /** * @description Save translation results immediately after each chunk is completed * @default false */ saveImmediately?: boolean; /** * @description Split locale JSON by token */ splitToken?: number; /** * @description Sampling temperature to use */ temperature?: number; /** * @description Nucleus sampling threshold */ topP?: number; } declare enum MarkdownModeType { MDAST = "mdast", STRING = "string" } type MarkdownMode = MarkdownModeType; type MarkdownModeFunction = (config: { fileContent: string; filePath: string; }) => MarkdownModeType; interface MarkdownConfig { /** * @description The entry file or folder, support glob */ entry: string[]; /** * @description Markdown extension */ entryExtension?: string; /** * @description The language that will use as translation ref */ entryLocale?: string; /** * @description The markdown that will ignore, support glob */ exclude?: string[]; /** * @description Whether to include matter in the translation */ includeMatter?: boolean; /** * @description Markdown translate mode */ mode?: MarkdownMode | MarkdownModeFunction; /** * @description Markdown extension generator function */ outputExtensions?: (locale: string, config: { fileContent: string; filePath: string; getDefaultExtension: (locale: string) => string; }) => string; /** * @description All languages that need to be translated */ outputLocales?: string[]; /** * @description In Mdast mode, whether to translate code block */ translateCode?: boolean; } interface I18nConfig extends I18nConfigLocale { experimental?: { jsonMode?: boolean; }; markdown?: MarkdownConfig; } type Config = I18nConfig; declare const defineConfig: (config: Partial<Config>) => Config; export { type Config, defineConfig };