kawkab-frontend
Version:
Kawkab frontend is a frontend library for the Kawkab framework
58 lines (57 loc) • 1.89 kB
TypeScript
/**
* Translator class for use outside React components
*/
export declare class Translator {
private i18n;
constructor();
/**
* Translate a specific text - safe version with SSR support
* @param key Translation key
* @param fallback Fallback text if translation not found
* @param options Additional translation options
* @returns Translated text
*/
translate(key: string, fallback?: string, options?: any): string;
/**
* Shortcut for the translate function
* @param key Translation key
* @param fallback Fallback text if translation not found
* @param options Additional translation options
* @returns Translated text
*/
t(key: string, fallback?: string, options?: any): string;
/**
* Change the language
* @param lng Language code
* @returns Promise
*/
changeLanguage(lng: string): Promise<any>;
/**
* Get the current language
* @returns Current language code
*/
getCurrentLanguage(): string;
/**
* Check the language direction
* @param language Language code
* @returns Language direction
*/
getLanguageDirection(language: string): 'rtl' | 'ltr';
/**
* Check if the current language is RTL
* @returns true if the language is RTL
*/
isRTL(): boolean;
/**
* Check if the current language is LTR
* @returns true if the language is LTR
*/
isLTR(): boolean;
}
export declare const translator: Translator;
export declare const t: (key: string, fallback?: string, options?: any) => string;
export declare const changeLanguage: (lng: string) => Promise<any>;
export declare const getCurrentLanguage: () => string;
export declare const getLanguageDirection: (language: string) => "rtl" | "ltr";
export declare const isRTL: () => boolean;
export declare const isLTR: () => boolean;