/** * Custom error class thrown when translation is skipped due to rate limiting */ export declare class TranslationSkippedError extends Error { readonly retryAfter?: number; constructor(targetLang: string, retryAfter?: number); } /** * Custom error class for rate limiting and quota exceeded errors */ export declare class RateLimitedError extends Error { readonly response: { status: number; headers?: Record; }; readonly retryAfter?: number; constructor(message: string, retryAfter?: number, headers?: Record); } /** * Resets the rate limiting state. Useful for testing or when starting a new translation session. */ export declare function resetRateLimitState(): void; /** * Clears the translation cache. Useful for testing. */ export declare function clearTranslationCache(): void; /** * Gets the current rate limiting state. Useful for testing. */ export declare function getRateLimitState(): { isRateLimited: boolean; rateLimitRetryAfter?: number; }; /** * Sets the rate limiting state. Useful for testing. */ export declare function setRateLimitState(rateLimited: boolean, retryAfter?: number): void; /** * Translates text using the Google Translate API. * * @param text The text to translate * @param targetLang The target language code * @param key Optional key name for better error reporting * @returns The translated text * @throws {TranslationSkippedError} When translation is skipped due to rate limiting */ export declare function translateText(text: string, targetLang: string, key?: string): Promise;