Communitygithub.com

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

ハードコードされた文字列の検出、翻訳管理、ロケールファイル、RTL対応など、国際化(i18n)と地域化(L10n)のパターンを提供します。

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

このスキルは、ソフトウェアプロジェクトにおける国際化(i18n)と地域化(L10n)のベストプラクティスを包括的にカバーします。開発者がアプリケーションを翻訳可能にし、複数の言語や地域に適合させるための実装パターンやファイル構造、チェックリストを提供します。React(react-i18next)、Next.js(next-intl)、Python(gettext)など、主要なフレームワークや言語に対応したコード例を含み、翻訳キーの使用、名前空間による翻訳管理、複数形対応、日付・数値フォーマット、RTL(右から左)レイアウト対応などの重要な概念を解説します。また、ハードコードされた文字列の検出や不足翻訳のチェックを行うためのスクリプトも提供し、開発プロセスにi18nを統合するための実用的なガイドとして機能します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AbobakrDiara61/railway-system/tree/HEAD/frontend/skills/i18n-localization

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

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

ドキュメント

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

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


1. 基本概念

用語意味
i18n国際化(Internationalization) - アプリを翻訳可能にする
L10n地域化(Localization) - 実際の翻訳
Locale(ロケール)言語+地域(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 20 individual skills — each has its own dedicated page.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

AbobakrDiara61/railway-system

One sentence - what this skill does and when to invoke it

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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 悬停效果

AbobakrDiara61/railway-system

Best practices for Remotion - Video creation in React

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

One sentence - what this skill does and when to invoke it

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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

関連スキル