Configures internationalization for React Router framework mode using remix-i18next. Covers middleware, locale detection, language switching, and resource routes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sergiodxa-agent-skills-1:frontend-internationalization-best-practicesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Guidelines for building a React Router i18n setup with `remix-i18next`. Focuses on middleware detection, locale storage, type safety, and client/server synchronization.
Guidelines for building a React Router i18n setup with remix-i18next. Focuses on middleware detection, locale storage, type safety, and client/server synchronization.
remix-i18next middleware/api/localesConfigure createI18nextMiddleware and type-safe resources.
export const [i18nextMiddleware, getLocale, getInstance] =
createI18nextMiddleware({
detection: {
supportedLanguages: ["es", "en"],
fallbackLanguage: "en",
cookie: localeCookie,
},
i18next: { resources },
plugins: [initReactI18next],
});
Define locale resources per language and re-export.
// app/locales/en/translation.ts
export default { title: "Example" };
Use a single namespace for small apps; multiple namespaces for large apps.
// Large app: common + route namespaces
export default { common, home, notFound };
Prefer cookie/session for speed, with DB as source of truth.
export const [i18nextMiddleware, getLocale] = createI18nextMiddleware({
detection: { cookie: localeCookie, fallbackLanguage: "en" },
});
Store locale in cookie/session and keep it in sync.
return data(
{ locale },
{ headers: { "Set-Cookie": await localeCookie.serialize(locale) } },
);
Send locale to the UI and sync <html lang dir>.
export async function loader({ context }: Route.LoaderArgs) {
let locale = getLocale(context);
return data(
{ locale },
{ headers: { "Set-Cookie": await localeCookie.serialize(locale) } },
);
}
Initialize i18next client with htmlTag detection.
i18next.init({ detection: { order: ["htmlTag"], caches: [] } });
Reuse the middleware instance in SSR with I18nextProvider.
<I18nextProvider i18n={getInstance(routerContext)}>
<ServerRouter context={entryContext} url={request.url} />
</I18nextProvider>
Serve /api/locales/:lng/:ns with validation and cache headers.
return data(namespaces[ns.data], { headers });
Use the bound t() in loaders and useTranslation in components.
let t = getInstance(context).getFixedT(locale);
Provide a 404 route so middleware runs and translations load.
npx claudepluginhub sergiodxa/agent-skillsNext.js 16 internationalization with next-intl or DIY. Use when implementing i18n, translations, localization, multilingual, language switch, locale routing, or formatters.
Builds multi-language applications with next-intl, react-i18next, ICU messages, RTL support, and locale-aware formatting. Activates on i18n, internationalization, translation, or localization mentions.
Adds internationalization to Next.js App Router projects using next-intl, with locale routing, translation files, hreflang sitemaps, and bulk translation across 14+ languages.