Get started in 3 steps
- 01
Install the app-side SDK
Use @better-i18n/remix in your Remix, React Router or Hydrogen app so translated content can be shared across route modules.
terminalbashnpm install lefine - 02
Resolve locale on the server
Read locale from request, route params, or storefront context and pass it into your app root.
app/root.tsximport { createStrings } from 'lefine/server';// Create once at module scope (or in app/strings.server.ts)const strings = createStrings({ project: 'app_3f9c0e4b2a7d4e1f9b6c5a8d7e2f1a0b',});// The locale comes from your route, e.g. /:locale/...export async function loader({ params }: LoaderFunctionArgs) { const locale = params.locale ?? 'en'; return strings.load(locale, ['common', 'product']);} - 03
Hydrate the provider in the root route
Provide the locale once so nested routes, product pages, and cart UI all share the same translation source.
app/root.tsximport { StringsProvider } from 'lefine/react';export default function App() { const props = useLoaderData<typeof loader>(); return ( <StringsProvider {...props}> <Outlet /> </StringsProvider> );}