i18n-ai-translate
Version:
AI-powered localization CLI, Node library, and GitHub Action. Translate i18next JSON, Gettext PO, Java .properties, and iOS .strings with ChatGPT, Claude, Gemini, or local Ollama models.
133 lines (132 loc) • 3.03 kB
TypeScript
import { z } from "zod";
export type TranslateItem = {
id: number;
key: string;
original: string;
translated: string;
context: string;
translationTokens: number;
verificationTokens: number;
templateStrings: string[];
translationAttempts: number;
verificationAttempts: number;
failure: string;
};
export type TranslateItemInput = {
id: number;
original: string;
context?: string;
failure?: string;
};
export declare const TranslateItemOutputSchema: z.ZodObject<{
id: z.ZodNumber;
translated: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
translated: string;
}, {
id: number;
translated: string;
}>;
export type TranslateItemOutput = {
id: number;
translated: string;
};
export declare const TranslateItemOutputObjectSchema: z.ZodObject<{
items: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
translated: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
translated: string;
}, {
id: number;
translated: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
items: {
id: number;
translated: string;
}[];
}, {
items: {
id: number;
translated: string;
}[];
}>;
export type TranslateItemOutputObject = {
items: TranslateItemOutput[];
};
export type VerifyItemInput = {
id: number;
original: string;
translated: string;
context: string;
failure: string;
};
export declare const VerifyItemOutputSchema: z.ZodObject<{
fixedTranslation: z.ZodString;
id: z.ZodNumber;
issue: z.ZodString;
valid: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
id: number;
valid: boolean;
fixedTranslation: string;
issue: string;
}, {
id: number;
valid: boolean;
fixedTranslation: string;
issue: string;
}>;
export type VerifyItemOutput = {
id: number;
valid: boolean;
issue: string;
fixedTranslation: string;
};
export declare const VerifyItemOutputObjectSchema: z.ZodObject<{
items: z.ZodArray<z.ZodObject<{
fixedTranslation: z.ZodString;
id: z.ZodNumber;
issue: z.ZodString;
valid: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
id: number;
valid: boolean;
fixedTranslation: string;
issue: string;
}, {
id: number;
valid: boolean;
fixedTranslation: string;
issue: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
items: {
id: number;
valid: boolean;
fixedTranslation: string;
issue: string;
}[];
}, {
items: {
id: number;
valid: boolean;
fixedTranslation: string;
issue: string;
}[];
}>;
export type VerifyItemOutputObject = {
items: VerifyItemOutput[];
};
export type GenerateStateJSON = {
fixedTranslationMappings: {
[input: string]: string;
};
translationToRetryAttempts: {
[translation: string]: number;
};
generationRetries: number;
};