@amazon-devices/expo-localization provides an interface for native user localization information.
It provdes getCalendars() and getLocales() method and their corresponding hooks, which return specific information about user’s locale settings, for example languageCode, uses24HourClock, currencyCode and textDirection. It itself doesn’t provide any methods for formatting text or values. Hooks will trigger a re-render when the app locale changes.
This is a system-deployed library and is available to React Native for Vega apps without a separate installation process. It is deployed as an autolinking library which your app links to at runtime. Compatibility is guaranteed only between the library and the version of React Native for Vega for which it is built.
Installation
- Add the JavaScript library dependency in the
package.jsonfile. Select the tab for your React Native version.
- React Native 0.72
- React Native 0.83
- Reinstall dependencies using
npm installcommand.
Examples
The example below demonstrates how to retrieve a user’s language code.API reference
Check out the dedicated documentation page for info about this library, API reference and more: Official Expo documentation for expo-localization.Constants
Hooks
Methods
Implementation details
- The
regionfield onLocalizationtype is always null on Vega. - Functions
useLocales(),useCalendars(),getCalendars()andgetLocales()will always return array with one item in it, while other platforms could return empty array or multiple valid locales/calendars. - The deprecated constants and method:
getLocalizationAsync()aren’t supported on Vega

