useLanguage
TheuseLanguage hook provides access to internationalization features, allowing you to translate content and switch between languages in your application.
Import
Signature
Return Value
The hook returns an object with the following properties:Translation function that accepts a translation key and returns the translated string.
The i18next instance providing full access to the internationalization API.
The currently active language code (e.g., ‘en’, ‘es’, ‘fr’).
Function to change the application language. Accepts a language code as parameter.
Usage
Basic Translation
Language Switcher
Accessing Current Language
This hook wraps
react-i18next’s useTranslation hook, providing a consistent API for language management across BoxApp.