@tengerly/cookie-consent
Version:
A lightweight, customizable cookie consent solution for Next.js and modern web frameworks with comprehensive multi-language support
56 lines (48 loc) • 1.49 kB
TypeScript
/**
* Cookie Consent Translations TypeScript Definitions
* @version 1.0.0
* @author Tengerly
*/
export interface CookieConsentTranslation {
title: string;
message: string;
acceptAll: string;
acceptSome: string;
reject: string;
continue: string;
save: string;
close: string;
functionalTitle: string;
functionalDesc: string;
analyticsTitle: string;
analyticsDesc: string;
}
export interface CookieConsentTranslations {
en: CookieConsentTranslation;
fr: CookieConsentTranslation;
de: CookieConsentTranslation;
es: CookieConsentTranslation;
it: CookieConsentTranslation;
nl: CookieConsentTranslation;
pt: CookieConsentTranslation;
[key: string]: CookieConsentTranslation;
}
export type SupportedLanguage = 'en' | 'fr' | 'de' | 'es' | 'it' | 'nl' | 'pt';
export declare const translations: CookieConsentTranslations;
/**
* Detects the user's preferred language from browser settings
* @returns Language code (e.g., 'en', 'fr', 'de')
*/
export declare function detectLanguage(): SupportedLanguage;
/**
* Gets translations for a specific language
* @param language - Language code
* @returns Translation object
*/
export declare function getTranslations(language?: SupportedLanguage): CookieConsentTranslation;
/**
* Gets available language codes
* @returns Array of available language codes
*/
export declare function getAvailableLanguages(): SupportedLanguage[];
export default translations;