UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

73 lines (72 loc) 2.39 kB
import { TranslationFile } from "../../../types/translation.types"; import { TranslationFileContext } from "../types/translation.additional"; /** * Finds and analyzes translation files in a project */ export declare class TranslationFileFinder { private context; private translationFiles; private mainTranslationFile; /** * Creates a new translation file finder * @param context Translation file context */ constructor(context: TranslationFileContext); /** * Finds all translation files in the project * @returns Promise resolving when files are found */ findAllTranslationFiles(): Promise<void>; /** * Gets the discovered translation files * @returns Array of translation files */ getTranslationFiles(): TranslationFile[]; /** * Gets the main translation file (largest one) * @returns Main translation file or null if none found */ getMainTranslationFile(): TranslationFile | null; /** * Finds translation files in common locations */ private findTranslationFiles; /** * Finds translation files in a directory * @param dirPath Directory path * @returns Promise that resolves to an array of translation files */ private findFilesInDirectory; /** * Counts the number of translation entries in a file (recursive) * @param obj Translation object * @param prefix Optional prefix for recursive calls * @returns Number of translations */ private countTranslationEntries; /** * Determines the main translation file (largest one) * @returns The largest translation file or null if none found */ private determineMainTranslationFile; /** * Analyzes a translation file structure * @param file Translation file to analyze * @returns Analysis information about the file */ analyzeTranslationFile(file: TranslationFile): { keysCount: number; nestedLevels: number; languageCode: string | null; format: "flat" | "nested"; }; /** * Gets information about the translation file format * @returns Information about translation file format */ detectTranslationLibrary(): { library: "next-intl" | "i18next" | "react-intl" | "unknown"; format: "flat" | "nested"; multiLanguage: boolean; }; }