[ React Native ]

Wrap React Native screens for react-i18next automatically

Text components get t() calls with useTranslation hooks injected, and the i18next init is scaffolded with bundled resources — no RSC gotchas, no network loaders.

1 Min. LesezeitAlle Frameworks

React Native i18n means react-i18next with bundled resources — there's no public/ directory to serve catalogs from. Polyglot wraps your screens and scaffolds an init module whose dictionaries ship inside the bundle.

The transformation

Before — src/screens/HomeScreen.tsx
import { View, Text } from 'react-native';

export default function HomeScreen() {
  return (
    <View>
      <Text>Welcome back</Text>
      <Text>Your projects are ready</Text>
    </View>
  );
}
After — src/screens/HomeScreen.tsx
import { View, Text } from 'react-native';
import { useTranslation } from 'react-i18next';

export default function HomeScreen() {
  const { t } = useTranslation('src.screens.HomeScreen');
  return (
    <View>
      <Text>{t('welcome_back')}</Text>
      <Text>{t('your_projects_are_ready')}</Text>
    </View>
  );
}

Every component is treated as a client component (there's no RSC in React Native), so hooks are injected wherever strings are wrapped — no server-component guard needed, and Polyglot knows that.

Setup and catalogs

Written — messages/en.json
{
  "src": {
    "screens": {
      "HomeScreen": {
        "welcome_back": "Welcome back",
        "your_projects_are_ready": "Your projects are ready"
      }
    }
  }
}
Translated — messages/de.json
{
  "src": {
    "screens": {
      "HomeScreen": {
        "welcome_back": "Willkommen zurück",
        "your_projects_are_ready": "Ihre Projekte sind bereit"
      }
    }
  }
}
Translated — messages/fr.json
{
  "src": {
    "screens": {
      "HomeScreen": {
        "welcome_back": "Bon retour",
        "your_projects_are_ready": "Vos projets sont prêts"
      }
    }
  }
}

The generated init uses initReactI18next with resources derived from the same catalog translate fills — one source of truth, bundled at build.

✓ 2 strings auto-wrapped · 0 flagged for manual review · 0 unsafe transforms → polyglot-i18n-report.md
✓ wiring checks passed (1 injected import(s), 2 catalog value(s), 1 catalog file(s))

Try it

$ curl -fsSL https://getpolyglot.ai/install.sh | sh
$ polyglot init --framework react-native
$ polyglot scan
$ polyglot wrap
$ polyglot translate --languages de   # 50 strings free, no signup

Im Terminal starten

Schluss mit der Suche nach unübersetzten Strings.

Installieren Sie die CLI, führen Sie einen Scan durch und sehen Sie genau, was Ihnen fehlt. Kostenlos, kein Konto erforderlich.

$curl -fsSL https://getpolyglot.ai/install.sh | sh
Wrap React Native screens for react-i18next automatically | Polyglot