Expo
API Reference
Complete API documentation for @better-i18n/expo
Complete API reference for the Expo/React Native SDK.
initBetterI18n
The primary API. Fetches translations from the better-i18n CDN, initializes i18next with all namespaces pre-loaded, and overrides changeLanguage() to pre-load translations before switching.
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import { initBetterI18n } from '@better-i18n/expo';
i18n.use(initReactI18next);
const { languages, core } = await initBetterI18n({
project: 'acme/my-app',
i18n,
defaultLocale: 'en',
useDeviceLocale: true,
debug: __DEV__,
});What it does
- Fetches the project manifest and initial translations from CDN in parallel
- Auto-discovers all namespaces and picks
"common"as the default (or first available) - Initializes i18next with translations pre-loaded into the resource store
- Overrides
changeLanguage()to pre-load translations before switching (no English flash) - Registers a
languageChangedlistener as a safety net for lazy loading
Options
Return Value
Do not call i18n.init() separately — initBetterI18n handles initialization internally. Use i18nextOptions to pass custom i18next settings.