Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
In this article, you learn how to use the react-native-localize package in your Vega TV app. You can read about the methods supported in the Vega SDK. The react-native-localize package helps you create a personalized experience for every user:
  • Handle multiple languages
  • Set date and time formats
  • Set currency
  • Manage other regional settings
The @amazon-devices/react-native-localize library uses Localize React Native in React Native for Vega (RNV) apps. This library provides localization and internationalization support, allowing you to adapt your app to different languages, regions, and cultures.

Why Localize Your TV App?

  • User Experience: Users prefer apps that speak their language and understand their regional preferences.
  • Global Reach: You can increase your app’s appeal to a broader audience in international markets.
  • Legal Compliance: You can ensure compliance with the regulations of various regions.

Installation

  1. Add the react-native-localize package as a dependency in package.json:
  2. Import getCurrencies into your preferred component:
  3. Run npm install on your project root to install the package.
  4. After a successful installation, run your Vega project.

Examples

Simulator versus device

Return values for the methods in the react-native-localize package might be different for a simulator than they are for a device. For example, the getCountry() method on a simulator returns US, but for a device, the return value is based on the device’s language setting. Here’s an example of how to use @amazon-devices/react-native-localize.

API reference

getLocales()

Returns a list of locales based on the user’s device.
  1. languageCode
  2. scriptCode
  3. languageTag
  4. isRTL

Method type

Possible output:

Example

Output: Screenshot showing the output on a simulator, displaying locale information such as language tag, language code, country code and if there is RTL or not.

getNumberFormatSettings()

Returns number formatting settings.

Method type

Example


getCurrencies()

Returns a list of all currencies.

Method type

Example

Possible output:

getCountry()

Returns the user’s current country code based on their device’s language setting. For example, if the language setting is English India, the country returns as IN. Note: if you’re using a simulator, the Time Zone property outputs Universal. For example, this output is with a device’s language setting set to English India.
For example, this output is with a device’s language setting set to American English.

Method type

Example 1

Example 2

You can display a custom message to the user based on their device’s location. In the following code, you can use:
  1. The getCountry() method from @amazon-devices/react-native-localize to get the country from the device.
  2. The useState() method to save the country code.
  3. A switch case to change the message as per the country code.
Note: To change the device location on a device, go to Settings > Preferences > Languages.
Output: Screenshot that shows the output on a Vega simulator device, displaying the IN country code and message. Screenshot that shows the output on a Vega simulator device, displaying the US country code and message.

Latin American regions

Devices using Latin American regional settings return “UN” instead of “419”, because “419” isn’t a standard country code.

getCalendar()

Returns the user’s preferred calendar format.

Method type

Example


getTemperatureUnit()

Returns the user’s preferred temperature unit.

Method type

Example


getTimeZone()

Returns the user’s current timezone based on the country from their device’s language setting. A simulator returns a Universal timezone. A TV device returns the timezone set in the device’s settings, such as Europe/London. For example, this output is with a device’s language setting set to American English.

Method type

Example


uses24HourClock()

Returns true if the user prefers a 24-hour clock format, false if the user prefers a 12-hour clock format.

Method type

Example


usesMetricSystem()

Returns true if the user prefers the metric measurement system, false if the user prefers imperial.

Method type

Example


usesAutoDateAndTime()

Displays whether or not the device enables the automatic date and time setting.

Method type

Example


usesAutoTimeZone()

Displays whether or not the device enables the automatic time zone setting.

Method type

Example


Supported versions


Last modified on December 22, 2025