jpskill.com
🛠️ 開発・MCP コミュニティ

next-intl

next-intlは、Next.jsアプリを多言語対応させる際に、言語ごとのルーティング設定や日付・数値の表示形式、UIコンテンツの翻訳などを効率的に行うための便利な機能を提供するSkill。

📜 元の英語説明(参考)

Internationalize Next.js apps with next-intl. Use when adding multi-language support, locale routing, date/number formatting, or translating UI content.

🇯🇵 日本人クリエイター向け解説

一言でいうと

next-intlは、Next.jsアプリを多言語対応させる際に、言語ごとのルーティング設定や日付・数値の表示形式、UIコンテンツの翻訳などを効率的に行うための便利な機能を提供するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o next-intl.zip https://jpskill.com/download/15164.zip && unzip -o next-intl.zip && rm next-intl.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15164.zip -OutFile "$d\next-intl.zip"; Expand-Archive "$d\next-intl.zip" -DestinationPath $d -Force; ri "$d\next-intl.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して next-intl.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → next-intl フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

next-intl

概要

next-intl は、Next.js App Router のための主要な i18n ライブラリです。ロケールルーティング、メッセージ翻訳、日付/数値のフォーマットを処理し、サーバーとクライアントの両方のコンポーネントで動作します。複数形と変数のための ICU メッセージ構文を使用します。

手順

ステップ 1: セットアップ

npm install next-intl
// i18n/request.ts — ロケール検出
import { getRequestConfig } from 'next-intl/server'

export default getRequestConfig(async ({ requestLocale }) => {
  const locale = await requestLocale || 'en'
  return {
    locale,
    messages: (await import(`../messages/${locale}.json`)).default,
  }
})
// messages/en.json
{
  "HomePage": {
    "title": "Welcome to {appName}",
    "description": "The best tool for {count, plural, one {# team} other {# teams}}",
    "cta": "Get Started"
  },
  "Dashboard": {
    "greeting": "Hello, {name}",
    "lastLogin": "Last login: {date, date, medium}"
  }
}
// messages/de.json
{
  "HomePage": {
    "title": "Willkommen bei {appName}",
    "description": "Das beste Tool für {count, plural, one {# Team} other {# Teams}}",
    "cta": "Jetzt starten"
  }
}

ステップ 2: サーバーコンポーネント

// app/[locale]/page.tsx — 翻訳されたサーバーコンポーネント
import { useTranslations } from 'next-intl'

export default function HomePage() {
  const t = useTranslations('HomePage')

  return (
    <main>
      <h1>{t('title', { appName: 'MyApp' })}</h1>
      <p>{t('description', { count: 5000 })}</p>
      <a href="/signup">{t('cta')}</a>
    </main>
  )
}

ステップ 3: ミドルウェアルーティング

// middleware.ts — ロケールルーティング
import createMiddleware from 'next-intl/middleware'

export default createMiddleware({
  locales: ['en', 'de', 'fr', 'ja'],
  defaultLocale: 'en',
  localePrefix: 'as-needed',        // /de/about but /about (for en)
})

export const config = { matcher: ['/((?!api|_next|.*\\..*).*)'] }

ガイドライン

  • ICU メッセージ構文: 複数形には {count, plural, one {# item} other {# items}} を使用します。
  • サーバーコンポーネント: useTranslations() を直接使用し、コンテキストは不要です。
  • クライアントコンポーネント: NextIntlClientProvider でラップします。
  • メンテナンス性を高めるために、メッセージキーはページ/コンポーネントごとに名前空間で区切って管理してください。
  • デフォルトロケールに /en/ プレフィックスを付けないように、localePrefix: 'as-needed' を使用します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

next-intl

Overview

next-intl is the leading i18n library for Next.js App Router. It handles locale routing, message translation, date/number formatting, and works with both server and client components. ICU message syntax for plurals and variables.

Instructions

Step 1: Setup

npm install next-intl
// i18n/request.ts — Locale detection
import { getRequestConfig } from 'next-intl/server'

export default getRequestConfig(async ({ requestLocale }) => {
  const locale = await requestLocale || 'en'
  return {
    locale,
    messages: (await import(`../messages/${locale}.json`)).default,
  }
})
// messages/en.json
{
  "HomePage": {
    "title": "Welcome to {appName}",
    "description": "The best tool for {count, plural, one {# team} other {# teams}}",
    "cta": "Get Started"
  },
  "Dashboard": {
    "greeting": "Hello, {name}",
    "lastLogin": "Last login: {date, date, medium}"
  }
}
// messages/de.json
{
  "HomePage": {
    "title": "Willkommen bei {appName}",
    "description": "Das beste Tool für {count, plural, one {# Team} other {# Teams}}",
    "cta": "Jetzt starten"
  }
}

Step 2: Server Components

// app/[locale]/page.tsx — Translated server component
import { useTranslations } from 'next-intl'

export default function HomePage() {
  const t = useTranslations('HomePage')

  return (
    <main>
      <h1>{t('title', { appName: 'MyApp' })}</h1>
      <p>{t('description', { count: 5000 })}</p>
      <a href="/signup">{t('cta')}</a>
    </main>
  )
}

Step 3: Middleware Routing

// middleware.ts — Locale routing
import createMiddleware from 'next-intl/middleware'

export default createMiddleware({
  locales: ['en', 'de', 'fr', 'ja'],
  defaultLocale: 'en',
  localePrefix: 'as-needed',        // /de/about but /about (for en)
})

export const config = { matcher: ['/((?!api|_next|.*\\..*).*)'] }

Guidelines

  • ICU message syntax: {count, plural, one {# item} other {# items}} for plurals.
  • Server components: use useTranslations() directly, no context needed.
  • Client components: wrap with NextIntlClientProvider.
  • Keep message keys namespaced by page/component for maintainability.
  • Use localePrefix: 'as-needed' to avoid /en/ prefix for default locale.