agentleFS
aymericzipaymericzip/intlayer-skills/skills/intlayer-next-js/SKILL.md

intlayer-next-js

Skill5 starsChanged 47 days agoApache-2.0View on GitHub

Integrates Intlayer internationalization with Next.js App Router and Pages Router. Use when the user asks to "setup Next.js i18n", use "useIntlayer" in Server Components, or handle client-side translations in Next.js.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create a content file using t() for translations.

    line 30

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Intlayer Next.js Usage

Core Philosophy

Intlayer promotes Component-Level Content Declaration. Instead of a massive global translation file, content is declared in *.content.ts files adjacent to the Next.js components that use them.

Workflow

To create a translated component, you need two files:

  1. Declaration: A content file (e.g., myComponent.content.ts) defining the dictionary.
  2. Implementation: A Next.js component (Server or Client) using the useIntlayer hook.

1. Declare Content

Create a content file using t() for translations. File: src/components/MyComponent/myComponent.content.ts

import { t, type Dictionary } from "intlayer";

const content = {
  // The 'key' must be unique and matches what you pass to useIntlayer()
  key: "my-component",
  content: {
    text: t({
      en: "Welcome",
      fr: "Bienvenue",
      es: "Hola",
    }),
  },
} satisfies Dictionary;

export default content;

Setup

  • Next.js
  • Next.js 14
  • Next.js 15
  • Page Router

Provider

Mount one IntlayerProvider (from next-intlayer/server) in the [locale] layout. It serves both server and client components, so pages don't wrap themselves (see the Next.js guide).

useIntlayer Hook

next-intlayer is isomorphic: the same useIntlayer import works in Server Components and in "use client" components.

import { useIntlayer } from "next-intlayer";

export const MyComponent = () => {
  const content = useIntlayer("my-component");

  return <h1>{content.text}</h1>;
};

Next.js package Documentation

Compiler

The Intlayer Compiler can extract all your content keys from your components, using one CLI command (npx intlayer extract) or automatically at app build.

References

Environments

  • Next.js
  • Next.js 14
  • Next.js 15
  • Next.js with Page Router
  • Intlayer with next-intl
  • Intlayer with next-i18next

Concepts

  • Variants
  • Collections
  • Compiler
  • Formatters (number, currency, date, …)

Packages

  • Intlayer Exports
  • Next Intlayer Exports
  • Next Intlayer Middleware
  • Next Intlayer T
  • Next Intlayer useDictionary
  • Next Intlayer useIntlayer
  • Next Intlayer useLocale
  • next-intlayer usePathname
  • next-intlayer useRewriteURL

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.