@jay-js/system
Version:
A powerful and flexible TypeScript library for UI, state management, lazy loading, routing and managing draggable elements in modern web applications.
34 lines (33 loc) • 1.25 kB
TypeScript
import type { Ti18nLanguages, Ti18nOptions } from "../types.js";
/**
* Initializes the internationalization system with the appropriate language
*
* This function:
* 1. Detects the browser language if available
* 2. Checks for saved language preference in localStorage
* 3. Sets the initial language
*
* @throws Error if the default language cannot be loaded
*/
export declare function initLanguage(): void;
/**
* Changes the active language
*
* @param {string} code - The language code to switch to
* @throws Error if the specified language code is not found in the available languages
*/
export declare function setLanguage(code: string): void;
/**
* Provides internationalization support and handles language loading
*
* @param {function} onLoad - Callback function that receives the language data when loaded
* @param {Partial<Ti18nOptions>} [options] - Optional configuration options for i18n
* @throws Error if no languages are defined in the options
*/
export declare function i18nProvider(onLoad: (i18n: Ti18nLanguages) => void, options?: Partial<Ti18nOptions>): void;
/**
* Returns the current active locale code
*
* @returns {string} The current locale code
*/
export declare function getCurrentLocale(): string;