cloudflare-next-intl
v0.1.1
Published
Optimized Next Intl Package Special for App Router and Cloudflare
Downloads
26
Maintainers
Readme
cloudflare-next-intl
Optimized internationalization (i18n) package specialized for Next.js App Router and Cloudflare environment.
Features
- Optimized for Cloudflare: Designed to work seamlessly with Cloudflare Pages and Workers.
- Server Components Support: Full support for Next.js App Router and Server Components.
- Fast and Efficient: Low overhead and minimal bundle size.
- Tree-shaking: Properly architected for optimal tree-shaking.
Installation
npm install cloudflare-next-intlUsage
Configuration
Set up your internationalization configuration:
import { setIntlConfig } from "cloudflare-next-intl/setIntlConfig";
export default setIntlConfig({
locales: ["en", "de"],
defaultLocale: "en",
// ... other config
});Server Components
import { getTranslations } from "cloudflare-next-intl/server";
export default async function Page() {
const t = await getTranslations("Index");
return <h1>{t("title")}</h1>;
}Client Components
"use client";
import { LocaleLink } from "cloudflare-next-intl/client";
export function Navigation() {
return (
<LocaleLink href="/about">
About Us
</LocaleLink>
);
}License
MIT
