@alnliang/tlv
Version:
Lightweight AI-powered tool for verifying and correcting translations in JSON language files using any OpenAI-compatible API
39 lines (38 loc) • 1.58 kB
TypeScript
import { RAGDocument } from '../interfaces/rag';
export interface ParallelTranslation {
id: string;
sourceText: string;
targetText: string;
sourceLanguage: string;
targetLanguage: string;
domain?: 'api' | 'ui' | 'documentation' | 'error-messages' | 'general';
context?: string;
sourceFile?: string;
}
export interface TranslationMemoryEntry {
sourceLanguage: string;
targetLanguage: string;
translations: Array<{
source: string;
target: string;
context?: string;
}>;
}
export interface TechnicalGlossaryEntry {
term: string;
translations: Record<string, string>;
domain: 'api' | 'ui' | 'documentation' | 'error-messages' | 'general';
definition?: string;
}
export declare class TranslationDataPreparer {
static prepareParallelCorpus(translations: ParallelTranslation[]): RAGDocument[];
static prepareTranslationMemory(entries: TranslationMemoryEntry[]): RAGDocument[];
static prepareTechnicalGlossary(glossary: TechnicalGlossaryEntry[]): RAGDocument[];
static prepareSoftwareLocalization(localizationData: Record<string, Record<string, string>>, sourceLanguage?: string, domain?: 'api' | 'ui' | 'documentation' | 'error-messages' | 'general'): RAGDocument[];
static prepareAPIDocumentation(apiDocs: Array<{
endpoint: string;
description: Record<string, string>;
parameters?: Record<string, Record<string, string>>;
}>, sourceLanguage?: string): RAGDocument[];
static mergeAndDeduplicate(...documentArrays: RAGDocument[][]): RAGDocument[];
}