useLocalization
Access localization functions for internationalization (i18n).
Usage
import { useLocalization } from '@multinaire/expo-ui';
function MyComponent() {
const { language, changeLanguage, translate } = useLocalization();
return (
<View>
<Text>{translate('welcome')}</Text>
<Text>Current: {language}</Text>
<Button title="Español" onPress={() => changeLanguage('es')} />
</View>
);
}
Return Value
| Property | Type | Description |
|---|---|---|
language | Language | Current language code (e.g., 'en', 'es') |
languages | Language[] | All supported locale codes derived from the translations prop |
changeLanguage | (lang: Language) => void | Switch to a different language |
translate | TFunction | i18next translation function |