import { I18nClass } from "@resk/core/i18n"; import { IUseI18nOptions } from "../types"; /** * @group Internationalization * @function useI18n * * A custom hook that provides an instance of the `I18nClass` class for managing internationalization (i18n) in the application. * This hook allows for the configuration of locale settings based on user preferences or device settings. * * @param {I18nClass} [i18n] - An optional instance of the `I18nClass` class. If provided, this instance will be used; otherwise, a new instance will be created. * * @param {IUseI18nOptions} [options] - An optional configuration object that defines how the i18n instance should handle locale settings. * This object can specify whether to use the device's locale and the specific locale to set. * * @returns {I18nClass} The configured instance of the `I18nClass` class, which can be used to manage translations and locale settings throughout the application. * * @example * // Example of using the useI18n hook in a functional component * const MyComponent = () => { * const i18nInstance = useI18n(undefined, { useLocaleFromDevice: true }); * * return ( * {i18nInstance.t('welcome_message')} * ); * }; * * @example * // Example of using the useI18n hook with a specific locale * const MyComponentWithLocale = () => { * const i18nInstance = useI18n(undefined, { locale: 'fr-FR' }); * * return ( * {i18nInstance.t('welcome_message')} * ); * }; * * @note This hook is particularly useful for applications that require localization support, * allowing for flexible configuration of locale settings based on user preferences or device settings. * It also handles locale changes dynamically, ensuring that the application reflects the correct language and regional settings. */ export declare const useI18n: (i18n?: I18nClass, options?: IUseI18nOptions) => I18nClass;