@logistically/i18n-cli
Version:
Enterprise-grade CLI tool for extracting and managing translations in Logistically microservices
163 lines (162 loc) • 3.88 kB
TypeScript
export interface TranslationKey {
key: string;
text: string;
type: string;
file: string;
line: number;
context?: string;
priority?: 'high' | 'medium' | 'low';
category?: string;
}
export interface TranslationData {
keys: TranslationKey[];
totalKeys: number;
services: string[];
generatedAt: string;
metadata?: {
version: string;
environment: string;
totalFiles: number;
extractionTime: number;
};
}
export interface ExtractionOptions {
path?: string;
output?: string;
ignore?: string[];
patterns?: ExtractionPattern[];
verbose?: boolean;
validate?: boolean;
maxFileSize?: number;
concurrency?: number;
includeComments?: boolean;
excludePatterns?: string[];
}
export interface ExtractionPattern {
regex: RegExp;
type: string;
description: string;
priority?: number;
validation?: {
minLength?: number;
maxLength?: number;
required?: boolean;
};
}
export interface GenerationOptions {
input?: string;
output?: string;
languages?: string[];
template?: boolean;
verbose?: boolean;
format?: 'json' | 'yaml' | 'csv';
includeMetadata?: boolean;
validateTranslations?: boolean;
backupExisting?: boolean;
dryRun?: boolean;
}
export interface ReplaceOptions {
path?: string;
keysFile?: string;
backup?: boolean;
dryRun?: boolean;
verbose?: boolean;
validate?: boolean;
maxReplacements?: number;
excludeFiles?: string[];
includeFiles?: string[];
preserveFormatting?: boolean;
}
export interface ServiceTranslation {
serviceName: string;
translations: Record<string, string>;
totalKeys: number;
metadata?: {
lastUpdated: string;
version: string;
translator?: string;
};
}
export interface CLICommand {
name: string;
description: string;
action: (options: any) => Promise<void>;
}
export interface CLIConfig {
version: string;
environment: 'development' | 'staging' | 'production';
logging: {
level: 'debug' | 'info' | 'warn' | 'error';
format: 'text' | 'json';
output: 'console' | 'file' | 'both';
filePath?: string;
};
performance: {
maxConcurrency: number;
maxFileSize: number;
timeout: number;
};
security: {
validateInputs: boolean;
sanitizeOutputs: boolean;
maxKeyLength: number;
};
features: {
enableValidation: boolean;
enableBackup: boolean;
enableDryRun: boolean;
enableProgressBar: boolean;
};
}
export interface ValidationResult {
isValid: boolean;
errors: ValidationError[];
warnings: ValidationWarning[];
}
export interface ValidationError {
type: 'critical' | 'error' | 'warning';
message: string;
file?: string;
line?: number;
code?: string;
}
export interface ValidationWarning {
message: string;
suggestion?: string;
file?: string;
line?: number;
}
export interface PerformanceMetrics {
startTime: number;
endTime: number;
duration: number;
filesProcessed: number;
totalKeys: number;
memoryUsage: number;
cpuUsage: number;
}
export interface SecurityContext {
inputValidation: boolean;
outputSanitization: boolean;
sanitizeOutputs: boolean;
fileAccessControl: boolean;
maxFileSize: number;
maxKeyLength: number;
allowedFileTypes: string[];
}
export interface ProgressOptions {
total: number;
title: string;
description?: string;
showPercentage?: boolean;
showSpeed?: boolean;
showETA?: boolean;
}
export interface ProgressUpdate {
current: number;
total: number;
percentage: number;
speed?: number;
eta?: number;
status: 'processing' | 'completed' | 'error';
}