{"library":"react-native-localize","title":"React Native Localize Toolbox","description":"react-native-localize is a comprehensive toolkit designed to streamline localization within React Native applications, including robust support for Android, iOS, macOS, and Web platforms via react-native-web. The current stable version is 3.7.0. The library's release cadence closely follows React Native's own support policy, focusing on compatibility with the latest version and the two previous minor series. Key differentiators include its broad cross-platform compatibility, an official Expo config plugin (introduced in 3.5.0 and actively refined), and recent additions like server-side rendering (SSR) support in version 3.6.0. It provides essential utilities for accessing device locale information, currency symbols, and managing right-to-left (RTL) layouts, integrating seamlessly into existing React Native projects. The library ships with TypeScript types for enhanced developer experience.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install react-native-localize"],"cli":null},"imports":["import { getLocales, getCurrencies } from 'react-native-localize';","import localize from 'react-native-localize/expo';","import type { Locale } from 'react-native-localize';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import React, { useEffect, useState } from 'react';\nimport { Text, View, StyleSheet, Platform } from 'react-native';\nimport {\n  getLocales,\n  getCurrencies,\n  getTimezone,\n  getCountry,\n  findBestAvailableLanguage,\n  isRTL,\n  addEventListener,\n  removeEventListener,\n  type Locale,\n} from 'react-native-localize';\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#F5FCFF',\n    padding: 20,\n  },\n  title: {\n    fontSize: 20,\n    textAlign: 'center',\n    margin: 10,\n  },\n  info: {\n    textAlign: 'center',\n    color: '#333333',\n    marginBottom: 5,\n  },\n});\n\nexport default function App() {\n  const [currentLocales, setCurrentLocales] = useState<Locale[]>(getLocales());\n\n  useEffect(() => {\n    const handleLocalesChange = () => {\n      setCurrentLocales(getLocales());\n    };\n    addEventListener('change', handleLocalesChange);\n    return () => removeEventListener('change', handleLocalesChange);\n  }, []);\n\n  const bestLanguage = findBestAvailableLanguage(['en', 'fr', 'es']);\n  const isCurrentLocaleRTL = isRTL();\n\n  return (\n    <View style={styles.container}>\n      <Text style={styles.title}>\n        React Native Localize Example\n      </Text>\n      <Text style={styles.info}>\n        Current Platform: {Platform.OS}\n      </Text>\n      <Text style={styles.info}>\n        Device Locales: {currentLocales.map(l => l.languageTag).join(', ')}\n      </Text>\n      <Text style={styles.info}>\n        Preferred Language (from ['en', 'fr', 'es']): {bestLanguage?.languageTag ?? 'N/A'}\n      </Text>\n      <Text style={styles.info}>\n        Device Country: {getCountry()}\n      </Text>\n      <Text style={styles.info}>\n        Device Currencies: {getCurrencies().join(', ')}\n      </Text>\n      <Text style={styles.info}>\n        Device Timezone: {getTimezone()}\n      </Text>\n      <Text style={styles.info}>\n        Is Right-to-Left (RTL): {isCurrentLocaleRTL ? 'Yes' : 'No'}\n      </Text>\n    </View>\n  );\n}","lang":"typescript","description":"This example demonstrates how to fetch and display various localization information from the device, including current locales, best available language, country, currencies, timezone, and RTL status, with a listener for locale changes. This is a runnable React Native component.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}