Communitygithub.com

i18nとローカライゼーションパターン

ハードコードされた文字列の検出、翻訳管理、ロケールファイル、RTL対応など、国際化(i18n)とローカライゼーション(L10n)のベストプラクティスを提供するスキルです。

i18nとローカライゼーションパターン とは?

このスキルは、フロントエンドアプリケーションにおける国際化(i18n)とローカライゼーション(L10n)の実装を支援するための包括的なガイドです。主にReact(react-i18next)、Next.js(next-intl)、Python(gettext)といったフレームワーク向けに、翻訳キーの管理、ロケールファイルの構造、RTL(右書き言語)対応のベストプラクティスを体系的にまとめています。具体的には、ハードコードされた文字列の検出方法、日付や数値のローカライズ、複数形処理、ICUメッセージフォーマットの活用、CSSの論理プロパティを用いたレイアウト対応など、現場で即活用できるパターンが含まれています。また、翻訳漏れやフォールバック設定、Linterスクリプトによる自動チェックなど、品質管理の観点もカバーしており、単一リージョンから多言語対応への拡張を計画する際に特に有用です。このスキルは、あらゆる開発環境で利用可能であり、プロジェクトに応じて適宜翻訳ファイルの構造やプラグイン設定を調整することで、効率的なローカライゼーションワークフローを実現します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AlperTuncOrtak/crypto-data-pipeline/tree/HEAD/skills/i18n-localization

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

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

ドキュメント

i18nとローカライゼーション

国際化(i18n)とローカライゼーション(L10n)のベストプラクティス


1. 基本概念

用語意味
i18n国際化 - アプリケーションを翻訳可能にする
L10nローカライゼーション - 実際の翻訳
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(_("アプリへようこそ"))

4. ファイル構造

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

5. ベストプラクティス

推奨 ✅

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

非推奨 ❌

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

6. よくある問題

問題解決策
翻訳がないデフォルト言語にフォールバックする
ハードコードされた文字列Linter/チェッカースクリプトを使用する
日付フォーマット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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

Pull a YouTube video transcript into a queryable markdown vault with yt-dlp subtitle discovery, VTT cleanup, metadata frontmatter, and capture-seed stubs.

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

Best practices for Remotion - Video creation in React

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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

AlperTuncOrtak/crypto-data-pipeline

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.

AlperTuncOrtak/crypto-data-pipeline

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

関連スキル