/expo-stack:expo-stack-i18nfrom expo-stack
Sets up typed i18n with react-i18next, i18next, and expo-localization in Expo Router apps — typed locale files, device-language detection, persisted user override, and RTL. Use when adding localization, adding a language, or when translations resolve to keys instead of text.
Ships in expo-stack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
react-i18next + i18next + expo-localization. The setup is small; the parts that go wrong are the init order and the shape of the resource object.
npx expo install expo-localization
bun add react-i18next i18next # or your project's manager
expo-localization adds a config plugin to app.json automatically — confirm it is there after install. It works in Expo Go, so no rebuild is needed for i18n alone.
// src/i18n/locales/en.ts
export const en = {
common: { cancel: 'Cancel', save: 'Save', retry: 'Try again' },
home: { title: 'Hello world', empty: 'Nothing here yet' },
settings: { language: 'Language', system: 'Use device language' },
} as const
export type Translations = typeof en
// src/i18n/locales/es.ts
import type { Translations } from './en'
export const es: Translations = {
common: { cancel: 'Cancelar', save: 'Guardar', retry: 'Reintentar' },
home: { title: 'Hola mundo', empty: 'Aquí no hay nada todavía' },
settings: { language: 'Idioma', system: 'Usar idioma del dispositivo' },
}
English is the source of truth and exports the type; every other locale is annotated with it, so a missing or misspelled key is a compile error rather than a string that silently falls back at runtime. This is the single highest-value decision in the whole setup.
Do not add as const to the source locale. It looks like an improvement and it breaks the whole pattern: Translations would then carry literal types (cancel: 'Cancel'), so every other locale would have to repeat the English text to typecheck — cancel: 'Cancelar' becomes Type '"Cancelar"' is not assignable to type '"Cancel"'. Without it, values widen to string, which is exactly what you want: keys checked, text free.
File names are the language code (en.ts, es.ts, pt-BR.ts) — it makes the resource map mechanical.
Namespace by screen, plus a common group for repeated actions. Flat files become unnavigable at around 100 strings.
// src/i18n/index.ts
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import { getLocales } from 'expo-localization'
import Storage from 'expo-sqlite/kv-store'
import { en } from './locales/en'
import { es } from './locales/es'
export const resources = {
en: { translation: en },
es: { translation: es },
} as const
export const supportedLanguages = Object.keys(resources) as (keyof typeof resources)[]
export const languageLabels: Record<string, string> = { en: 'English', es: 'Español' }
const OVERRIDE_KEY = 'language-override'
export function resolveDeviceLanguage() {
const code = getLocales()[0]?.languageCode
return code && code in resources ? code : 'en'
}
export function resolveInitialLanguage() {
const override = Storage.getItemSync(OVERRIDE_KEY) // sync — decides the first frame
if (override && override !== 'system' && override in resources) return override
return resolveDeviceLanguage()
}
i18n.use(initReactI18next).init({
resources,
lng: resolveInitialLanguage(),
fallbackLng: 'en',
supportedLngs: supportedLanguages,
interpolation: { escapeValue: false }, // React already escapes
})
export async function changeLanguage(next: string) {
Storage.setItemSync(OVERRIDE_KEY, next)
await i18n.changeLanguage(next === 'system' ? resolveDeviceLanguage() : next)
}
export default i18n
Notes on the details:
{ translation: … } is not optional. Passing the locale object directly is the most common mistake, and the symptom is t('home.title') rendering the literal string home.title. If you see keys instead of text, check this first, then check the init import.interpolation.escapeValue: false — i18next's HTML escaping is for the web; React Native has no HTML and double-escaping mangles apostrophes.expo-sqlite/kv-store gives you that; AsyncStorage does not.'system' is a stored value, not a language — it means "follow the device", so the device locale is re-read on every launch.// src/app/_layout.tsx
import '@/i18n' // side-effect import — must run before any t() call
import '@/global.css'
Import once, at the top of the root layout. Not in a component, not lazily.
import { useTranslation } from 'react-i18next'
const { t } = useTranslation()
<Text>{t('home.title')}</Text>
<Text>{t('items.count', { count: items.length })}</Text>
Pluralisation uses i18next's _one / _other suffixes and the count option — do not hand-roll count === 1 ? … : …, since not every language has two plural forms.
import { changeLanguage, languageLabels, supportedLanguages } from '@/i18n'
// 'system' first, then each supported language
const options = ['system', ...supportedLanguages]
Ship the override even when device-locale detection works. A user whose phone is in one language but who wants the app in another is common — and it is also how QA checks translations without changing device settings.
import { I18nManager } from 'react-native'
import { getLocales } from 'expo-localization'
const isRTL = getLocales()[0]?.textDirection === 'rtl'
I18nManager.allowRTL(isRTL)
I18nManager.forceRTL(isRTL)
Two caveats: forceRTL needs an app restart to take effect, and once you support an RTL language every hardcoded marginLeft/left becomes a layout bug. Use logical properties (start/end, Tailwind's ms-*/me-*) from the beginning if RTL is even a possibility — retrofitting is a whole-app pass. Uniwind also offers LayoutDirection for forcing direction on a subtree.
Do not add the RTL block until you actually ship an RTL language; a permanently-false branch is dead code.
Mechanical enough to delegate: copy en.ts, translate the values, add it to resources and languageLabels. TypeScript reports anything missed. This is a good task to hand to an agent — the type annotation is the safety net that makes it safe to do so.
Do not put user-generated content, brand names, or Convex data through t(). Locale files are for UI chrome. Content localisation belongs in the data model.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
i18n, localization, expo-router, react-i18next, expo-localization
npx claudepluginhub flyingwebie/skills --plugin expo-stack14 skills in this plugin
/expo-stackScaffold, configure, diagnose, polish, and ship production Expo applications with the Expo Stack workflow in Codex./expo-stack-architectureFolder layout, the routes-only rule, platform file extensions, and monorepo/workspace wiring for an Expo Router app in this stack. Use when scaffolding a project, deciding where a new file belongs, adding a shared package, or fixing Metro resolution in a bun/pnpm/yarn workspace./expo-stack-asoApp Store Optimization as part of the build loop — the indexed metadata fields, keyword strategy, screenshots that rank as well as convert, review-prompt timing, and store localization matched to the app's locales. Use when preparing a store listing, choosing a title/subtitle/keywords, planning screenshots, adding a rating prompt, or asked why an app is not being found./expo-stack-data-authWiring Convex and Better Auth into an Expo Router app — cloud or self-hosted Convex, the expo/convex client plugins, route guards, and env-var discipline. Use when setting up or debugging auth, adding a Convex function or schema, choosing between cloud and self-hosted, or when sessions, cookies, redirects or convex env vars misbehave./expo-stack-deep-linkingDeep linking in this stack — app scheme, Universal Links / App Links, the `+native-intent.tsx` rewrite hook, and deferred deep linking that survives an App Store install. Use when adding share/invite links, handling an OAuth or magic-link callback, wiring referrals or attribution, or debugging a link that opens the wrong screen, opens the store instead of the app, or gets swallowed by an auth or onboarding gate./expo-stack-monetizationRevenueCat in an Expo app — install and config plugin, per-platform keys, entitlement gating, paywall placement, and store-review requirements. Use when adding subscriptions or in-app purchases, gating a feature behind a paywall, or debugging purchases, restores and entitlements.Other plugins' skills for the same job