UNPKG

@alnliang/tlv

Version:

Lightweight AI-powered tool for verifying and correcting translations in JSON language files using any OpenAI-compatible API

46 lines (45 loc) 1.33 kB
import { RAGProvider, RAGEnhancedVerificationOptions } from './interfaces/rag'; interface TranslationInput { [languageFile: string]: Record<string, string>; } export interface VerificationError { stringID: string; languageFile: string; error: string; current: string | null; suggestion: string; } export interface SingleFileResult { errors: VerificationError[]; "fixed-json": Record<string, string>; } export interface VerificationResult { [languageKey: string]: SingleFileResult | { _processingError: string; }; } export interface VerifierOptions { apiKey: string; baseURL?: string; model?: string; systemMessage?: string; userContext?: string; ragProvider?: RAGProvider; ragOptions?: RAGEnhancedVerificationOptions; } export declare class TranslationVerifier { private openai; private model; private systemMessage; private userContext; private ragProvider?; private ragOptions?; constructor(options: VerifierOptions); private enhanceWithRAGContext; private extractKeyTerms; private detectVariablePattern; private extractAllStrings; private generateSystemMessage; verifyTranslations(englishJson: Record<string, string>, translatedJsonMap: TranslationInput): Promise<VerificationResult>; } export {};