feat: translate comments and logs to English for better accessibility

This commit is contained in:
didavila
2026-03-25 08:44:39 +01:00
parent ad9a957be4
commit 5f34aa2f89
16 changed files with 87 additions and 65 deletions

View File

@@ -3,9 +3,9 @@ import fs from 'fs-extra';
import path from 'path';
import { logStep, logSuccess, logError, logInfo } from '../utils/logger';
/** Invoca `openapi-generator-cli` para generar DTOs en un directorio temporal. */
/** Invokes `openapi-generator-cli` to generate DTOs into a temporary directory. */
export function generateCode(swaggerFile: string, templatesDir: string): string {
logStep('Generando código desde OpenAPI...');
logStep('Generating code from OpenAPI spec...');
const tempDir = path.join(process.cwd(), '.temp-generated');
@@ -23,11 +23,11 @@ export function generateCode(swaggerFile: string, templatesDir: string): string
--additional-properties=ngVersion=17.0.0,modelFileSuffix=.dto,modelNameSuffix=Dto`;
execSync(command, { stdio: 'inherit' });
logSuccess('Código generado correctamente');
logSuccess('Code generated successfully');
return tempDir;
} catch (_error) {
logError('Error al generar código');
logError('Error generating code');
if (fs.existsSync(tempDir)) {
fs.removeSync(tempDir);
}
@@ -35,9 +35,9 @@ export function generateCode(swaggerFile: string, templatesDir: string): string
}
}
/** Copia los DTOs generados desde el directorio temporal al directorio de salida. */
/** Copies the generated DTOs from the temporary directory to the output directory. */
export function organizeFiles(tempDir: string, outputDir: string): void {
logStep('Organizando archivos DTO generados...');
logStep('Organising generated DTO files...');
const sourceDir = path.join(tempDir, 'model');
const destDir = path.join(outputDir, 'data/dtos');
@@ -58,12 +58,12 @@ export function organizeFiles(tempDir: string, outputDir: string): void {
});
}
logSuccess(`${filesMoved} DTOs movidos correctamente`);
logSuccess(`${filesMoved} DTOs moved successfully`);
}
/** Post-procesa los DTOs generados añadiendo imports y normalizando Array<T> → T[]. */
/** Post-processes the generated DTOs: adds cross-DTO imports and normalises Array<T> → T[]. */
export function addDtoImports(outputDir: string): void {
logStep('Añadiendo imports a los DTOs generados...');
logStep('Post-processing generated DTOs...');
const dtosDir = path.join(outputDir, 'data/dtos');
@@ -123,5 +123,5 @@ export function addDtoImports(outputDir: string): void {
}
});
logSuccess(`Imports añadidos a ${filesProcessed} DTOs`);
logSuccess(`${filesProcessed} DTOs post-processed`);
}