i18n-llm-translate
Version:
Automatically translates namespace-based JSON translation files across multiple languages from any source language
24 lines (23 loc) • 1.4 kB
TypeScript
import { z } from "zod";
import { TranslateOptions } from "./type";
export declare function validateTranslateOptions(options: TranslateOptions): void;
/**
* Extracts all variable names from a string that match the pattern {{ variableName }}
* @param str The string to extract variables from
* @returns Array of variable names found in the string
*/
export declare function extractVariablesFromString(str: string): string[];
/**
* Creates a zod schema that validates a string contains the same variables as the original
* @param originalString The original string to compare against
* @returns A zod schema that validates variable consistency
*/
export declare function createVariableConsistencySchema(originalString: string): z.ZodEffects<z.ZodString, string, string>;
/**
* Creates a zod schema for an object that validates all string values maintain variable consistency
* @param originalObject The original object to compare against
* @returns A zod schema that validates variable consistency for all string values
*/
export declare function createObjectVariableConsistencySchema(originalObject: Record<string, any>): z.ZodObject<any>;
export declare function generateLanguagesTranslateReturnZodSchema(targetLanguages: string[], differencesSchema: z.ZodObject<any>): z.ZodObject<any>;
export declare function generateTranslationsZodSchema(obj: Record<string, any>): z.ZodObject<any>;