as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
@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

  1. Add the JavaScript library dependency in the package.json file. Select the tab for your React Native version.
  1. Reinstall dependencies using npm install command.

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 region field on Localization type is always null on Vega.
  • Functions useLocales(), useCalendars(), getCalendars() and getLocales() 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

Additional resources

For information on additional libraries, see Supported Third-Party Libraries and Services.
最后修改于 2026年8月3日