Communitygithub.com

i18n & Localization(国際化・地域化)

国際化(i18n)と地域化(L10n)のベストプラクティス。ハードコードされた文字列の検出、翻訳管理、ロケールファイル、RTL対応。

i18n & Localization(国際化・地域化) とは?

このスキルは、ソフトウェア開発における国際化(i18n)と地域化(L10n)の実装パターンとベストプラクティスを包括的に提供します。公開WebアプリやSaaS製品など、多言語対応が必要なプロジェクトに特に有用です。React(react-i18next)、Next.js(next-intl)、Python(gettext)といった主要フレームワーク・言語ごとの実装例を示し、翻訳キーの使用、機能ごとの名前空間分割、複数形対応、ロケールごとの日付・数値フォーマット、RTL(右から左)言語への対応方法を解説します。また、ハードコードされた文字列を検出するスクリプト(scripts/i18n_checker.py)を同梱し、プロジェクト内の翻訳漏れや未翻訳の文字列を自動チェックできます。このスキールは、Claude Code、Cursor、CodexなどのAIエージェントがプロジェクトのローカライズ品質を向上させるための具体的なガイドラインとして機能します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Desesbraker/agentes-vip/tree/HEAD/full%20skill/plugins/antigravity-awesome-skills-claude/skills/i18n-localization

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

i18n & Localization(国際化・地域化) は何をしますか?

国際化(i18n)と地域化(L10n)のベストプラクティス。


1. 基本概念

用語意味
i18n国際化 - アプリを翻訳可能にする
L10n地域化 - 実際の翻訳
ロケール言語 + 地域(en-US、tr-TR)
RTL右から左へ書く言語(アラビア語、ヘブライ語)

2. i18n を使用するタイミング

プロジェクトタイプi18n の必要性
公開Webアプリ✅ 必要
SaaS製品✅ 必要
内部ツール⚠️ 場合による
単一地域アプリ⚠️ 将来を考慮
個人プロジェクト❌ 任意

3. 実装パターン

React(react-i18next)

import { useTranslation } from 'react-i18next';

function Welcome() {
  const { t } = useTranslation();
  return <h1>{t('welcome.title')}</h1>;
}

Next.js(next-intl)

import { useTranslations } from 'next-intl';

export default function Page() {
  const t = useTranslations('Home');
  return <h1>{t('title')}</h1>;
}

Python(gettext)

from gettext import gettext as _

print(_("Welcome to our app"))

4. ファイル構造

locales/
├── en/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
├── tr/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
└── ar/          # RTL
    └── ...

5. ベストプラクティス

推奨事項 ✅

  • 翻訳キーを使用し、生のテキストを使わない
  • 翻訳を機能ごとに名前空間で分割する
  • 複数形に対応する
  • ロケールごとの日付・数値フォーマットを処理する
  • RTLを最初から考慮する
  • 複雑な文字列には ICU メッセージ形式を使用する

非推奨 ❌

  • コンポーネント内に文字列をハードコードする
  • 翻訳済み文字列を連結する
  • 文字列の長さを想定する(ドイツ語は30%長くなる)
  • RTLレイアウトを忘れる
  • 同じファイル内で言語を混在させる

6. よくある問題

問題解決策
翻訳の欠落デフォルト言語にフォールバック
ハードコードされた文字列リンター/チェッカースクリプトを使用
日付形式Intl.DateTimeFormat を使用
数値形式Intl.NumberFormat を使用
複数形ICU メッセージ形式を使用

7. RTL 対応

/* CSS 論理プロパティ */
.container {
  margin-inline-start: 1rem;  /* margin-left ではなく */
  padding-inline-end: 1rem;   /* padding-right ではなく */
}

[dir="rtl"] .icon {
  transform: scaleX(-1);
}

8. チェックリスト

出荷前に:

  • すべてのユーザー向け文字列が翻訳キーを使用している
  • サポートするすべての言語のロケールファイルが存在する
  • 日付/数値のフォーマットに Intl API を使用している
  • RTLレイアウトをテスト済み(該当する場合)
  • フォールバック言語が設定されている
  • コンポーネント内にハードコードされた文字列がない

スクリプト

スクリプト目的コマンド
scripts/i18n_checker.pyハードコードされた文字列と欠落した翻訳を検出python scripts/i18n_checker.py <project_path>

使用タイミング

このスキルは、概要に記載されたワークフローやアクションを実行するために適用可能です。

Individual skills in this repo

This repo contains 16 individual skills — each has its own dedicated page.

Desesbraker/agentes-vip

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Desesbraker/agentes-vip

Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Desesbraker/agentes-vip

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

Desesbraker/agentes-vip

AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Desesbraker/agentes-vip

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

Desesbraker/agentes-vip

Best practices for Remotion - Video creation in React

Desesbraker/agentes-vip

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

Desesbraker/agentes-vip

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

Desesbraker/agentes-vip

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

Desesbraker/agentes-vip

Automate TikTok tasks via Rube MCP (Composio): upload/publish videos, post photos, manage content, and view user profiles/stats. Always search tools first for current schemas.

Desesbraker/agentes-vip

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

Desesbraker/agentes-vip

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

Desesbraker/agentes-vip

Automate YouTube tasks via Rube MCP (Composio): upload videos, manage playlists, search content, get analytics, and handle comments. Always search tools first for current schemas.

Desesbraker/agentes-vip

Extract transcripts from YouTube videos and generate comprehensive, detailed summaries using intelligent analysis frameworks

Desesbraker/agentes-vip

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

Desesbraker/agentes-vip

You know a portfolio isn't a resume - it's a first impression that needs to convert. You balance creativity with usability. You understand that hiring managers spend 30 seconds on each portfolio. You make those 30 seconds count. You help people stand out without being gimmicky.

関連スキル