sicua
Version:
A tool for analyzing project structure and dependencies
79 lines (78 loc) • 3.6 kB
TypeScript
import { TranslationFile } from "../../../types/translation.types";
import { TranslationFileContext } from "../types/translation.additional";
/**
* Finds all react-i18next translation files in the project
* @param context Translation file context
* @returns Promise that resolves to an array of translation files
*/
export declare function findReactI18nextTranslationFiles(context: TranslationFileContext): Promise<TranslationFile[]>;
/**
* Determines if a directory name represents a react-i18next language code
* @param dirName Directory name
* @returns Boolean indicating if it's a language directory
*/
export declare function isReactI18nextLanguageDirectory(dirName: string): boolean;
/**
* Determines if a JSON object is likely a react-i18next translation file
* @param content JSON content
* @returns Boolean indicating if it looks like a react-i18next translation file
*/
export declare function isLikelyReactI18nextTranslationFile(content: Record<string, any>): boolean;
/**
* Checks if content has nested string values
* @param node JSON node
* @returns Boolean indicating if it has string values
*/
export declare function hasNestedStringValues(node: any): boolean;
/**
* Counts the number of translation entries in a react-i18next file (recursive)
* @param obj Translation object
* @param prefix Optional prefix for recursive calls
* @returns Number of translations
*/
export declare function countReactI18nextTranslationEntries(obj: Record<string, any>, prefix?: string): number;
/**
* Determines the main react-i18next translation file (largest one in translation namespace)
* @param translationFiles Array of translation files
* @returns The main translation file or null if none found
*/
export declare function determineMainReactI18nextTranslationFile(translationFiles: TranslationFile[]): TranslationFile | null;
/**
* Extracts namespace from react-i18next file path
* @param file Translation file
* @returns Namespace string
*/
export declare function extractNamespaceFromReactI18nextFile(file: TranslationFile): string;
/**
* Checks if a translation key exists in the react-i18next translation object
* @param fullKey The full dot-notation key
* @param translations Translation object
* @returns Boolean indicating if the key exists
*/
export declare function translationExistsInReactI18nextObject(fullKey: string, translations: Record<string, any>): boolean;
/**
* Extracts all translation keys from a react-i18next translation object
* @param obj Translation object
* @param prefix Optional prefix for recursive calls
* @param result Array to collect results
*/
export declare function extractKeysFromReactI18nextTranslations(obj: Record<string, any>, prefix: string, result: string[]): void;
/**
* Flattens a nested react-i18next translation object for comparison
* @param obj Translation object
* @param prefix Optional prefix for recursive calls
* @param namespace Namespace of the translation file
* @param filePath File path of the translation file
* @param valueToKeysMap Map to collect values and their keys
*/
export declare function flattenReactI18nextTranslations(obj: Record<string, any>, prefix: string, namespace: string, filePath: string, valueToKeysMap: Map<string, Array<{
fullKey: string;
filePath: string;
namespace: string;
}>>): void;
/**
* Checks if text is significant enough to warn about duplication in react-i18next
* @param value The text value to check
* @returns Boolean indicating if the text is significant
*/
export declare function isSignificantReactI18nextText(value: string): boolean;