Better I18NBetter I18N

Quick Start

Get Better i18n running in your React app in under 5 minutes

Installation

npm install @better-i18n/use-intl use-intl
yarn add @better-i18n/use-intl use-intl
pnpm add @better-i18n/use-intl use-intl
bun add @better-i18n/use-intl use-intl

Add the Provider

Wrap your app with BetterI18nProvider:

src/App.tsx
import { BetterI18nProvider } from '@better-i18n/use-intl'

function App() {
  return (
    <BetterI18nProvider
      project="your-org/your-project"  // From dashboard
      locale="en"
    > // [!code ++]
      <YourApp />
    </BetterI18nProvider> 
  )
}

The project value uses org/project format from your Better i18n dashboard.

Use Translations

Use the useTranslations hook in any component:

src/components/Welcome.tsx
import { useTranslations } from '@better-i18n/use-intl'

export function Welcome() {
  const t = useTranslations('home') 

  return (
    <div>
      <h1>{t('title')}</h1>
      <p>{t('description')}</p>
    </div>
  )
}

That's It!

Your app now:

  • ✅ Fetches translations from the Better i18n CDN
  • ✅ Supports dynamic language switching
  • ✅ Auto-discovers available languages from your project

Choose Your Framework

Each guide covers framework-specific patterns like SSR, routing, and middleware.

Framework Comparison

FrameworkRenderingRoutingBest For
TanStack StartSSR + CSRFile-basedFull-stack React, SEO
Vite + ReactCSROptionalSPAs, prototypes
Next.jsSSR + CSRApp RouterProduction apps

Feature Matrix

FeatureTanStack StartViteNext.js
Server messages
Path-based localeManual
Middleware
Static generation
Edge runtime
Bundle size~2KB~2KB~5KB

Not sure? Start with Vite + React for the simplest setup, then upgrade to TanStack Start or Next.js when you need SSR.


Core Concepts

Learn the fundamentals that apply to all frameworks:

On this page