NextGlobeGen makes it effortless to deliver your content in multiple languages with SEO-optimized, localized URLs.
NextGlobeGen is a powerful TypeScript-first internationalization (i18n) library for Next.js App Router applications. Unlike traditional i18n solutions, NextGlobeGen uses generative programming to automatically create localized routes and type-safe APIs, giving you a seamless development experience with full TypeScript support.
/en/about → /fi/tietoja)import { useTranslations, Link } from "next-globe-gen";
export default function HomePage() {
const t = useTranslations();
return (
<div>
<h1>{t("welcome")}</h1>
<p>{t("description", { name: "NextGlobeGen" })}</p>
<Link href="/dashboard">{t("dashboard.title")}</Link>
</div>
);
}
{
"welcome": "Welcome!",
"description": "{name} makes i18n effortless",
"dashboard": {
"title": "Dashboard"
}
}
This automatically works for all configured locales with zero additional code!
The plugin watches your src/_app directory and automatically generates localized versions of your routes in real-time:
src/_app/about/page.tsx → src/app/(i18n)/en/about/page.tsx
→ src/app/(i18n)/fi/tietoja/page.tsx
No manual route duplication. No runtime route matching. Just write your routes once, and NextGlobeGen handles the rest.
Get full TypeScript support across your entire i18n implementation:
// Routes are type-checked
<Link href="/blog/[slug]" params={{ slug: "hello" }}>
Post
</Link>;
// Message keys are autocompleted
const t = useTranslations("dashboard");
t("title"); // ✓ Type-safe
t("typo"); // ✗ TypeScript error
// Locale switching with preserved params
const route = useRoute(); // Type: "/blog/[slug]"
const params = useParams<RouteParams<typeof route>>();
<Link href={route} params={params} locale="fi">
Suomeksi
</Link>;
Support for rich text formatting with plurals, select, dates, and React components:
{
"welcome": "Welcome {name}!",
"posts": "{count, plural, =0 {No posts} one {One post} other {# posts}}",
"updated": "Last updated: {date, date, long}",
"richText": "Read <link>our guide</link> for more info"
}
t("welcome", { name: "Jon" });
t("posts", { count: 5 });
t("updated", { date: new Date() });
t("richText", { link: (children) => <Link href="/guide">{children}</Link> });
Choose the routing strategy that fits your needs:
Prefix-Based Routing (e.g., example.com/en, example.com/fi)
const config = {
locales: ["en", "fi"],
defaultLocale: "en",
prefixDefaultLocale: true, // or false for root default locale
};
Domain-Based Routing (e.g., example.com, example.fi)
const config = {
domains: [
{ domain: "example.com", locales: ["en"], defaultLocale: "en" },
{ domain: "example.fi", locales: ["fi"], defaultLocale: "fi" },
],
};
The included proxy/middleware handles:
The same API works everywhere:
// "use client"; just add this directive for Client Components
import { useLocale, useTranslations } from "next-globe-gen";
export default function ServerComponent() {
const locale = useLocale();
const t = useTranslations();
return <h1>{t("title")}</h1>;
}
Need async functions? Use the get* aliases:
export async function generateMetadata() {
const t = getTranslations();
return { title: t("pageTitle") };
}
Ready to internationalize your Next.js app? Follow our Getting Started Guide to set up NextGlobeGen in minutes.
If you're familiar with next-intl or considering alternatives, check out our detailed comparison to understand the differences and see which approach fits your project best.