Expo Preset
The Expo preset helps you set up internationalization (i18n) in your Expo project with minimal configuration. It integrates with Expo's localization system and sets up all necessary files and configurations for managing translations.
Prerequisites
- An Expo project
- Git initialized repository
- Node.js and npm/yarn/pnpm
Getting Started
Navigate to your Expo project root and run:
Configure your source and target languages when prompted, or create a neoiq-localize.json file:
What Gets Set Up
The preset will:
Install required dependencies:
i18n-js- For handling translationsexpo-localization- For detecting device locale
Create the following directory structure:
i18n.ts
en.json
[lang].json
en.json
[lang].json
README.md
Configure your app.json for localization support:
- Enables mixed localizations for iOS
- Adds expo-localization plugin
- Sets up native localization paths
Usage
Basic Translation
Import the i18n instance in your components:
Translation Files
The preset creates two types of translation files:
-
Regular translations (
locales/[lang].json):locales/[lang].json -
Native translations (
locales/native/[lang].json):locales/native/[lang].json
Managing Translations
Add new translation keys to your source language file (locales/[source].json)
Run the translation command:
Best Practices
- Always use translation keys in your code instead of hardcoded strings
- Keep translation keys organized and descriptive
- Use the native translations for app store metadata and system permissions
- Commit translation files to version control
Troubleshooting
Additional Configuration
The preset supports customization through the neoiq-localize.json file:
For more advanced configuration options, refer to the NeoIQ Localize configuration documentation.
How is this guide?
Edit on GitHub
Last updated on