@amazon-devices/expo-localization provides an interface for native user localization information.
This library provides the getCalendars() and getLocales() methods and their corresponding hooks, which return specific information about a user’s locale settings, for example languageCode, uses24HourClock, currencyCode and textDirection. No methods are provided for formatting text or values. Hooks trigger a re-render when the app locale changes.
This library is system-deployed and available to React Native for Vega apps without a separate installation process. This autolinking library connects to your app 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. -
Reinstall dependencies using the
npm installcommand.
Examples
This example demonstrates how to retrieve a user’s language code.API reference
Check out the dedicated documentation page for info about this library and API reference: Official Expo documentation for expo-localization.Constants
Hooks
Methods
Known issues and limitations
- The
regionfield onLocalizationtype is always null on Vega. - Functions
useLocales(),useCalendars(),getCalendars()andgetLocales()always return an array with one item in it, while other platforms could return empty arrays or multiple valid locales/calendars. - The deprecated constants and method
getLocalizationAsync()aren’t supported on Vega.

