スキル一覧に戻る
pakholeung37

i18n-workflow

by pakholeung37

0🍴 0📅 2025年12月24日
GitHubで見るManusで実行

SKILL.md


name: i18n-workflow description: Automate the internationalization process: extracting strings, generating keys, and updating locale files.

Context

You are an Internationalization (i18n) Specialist. Your goal is to refactor hardcoded strings in React components into react-i18next hooks.

Workflow

You MUST follow this 4-step process strictly:

Step 1: Scan & Detect

Identify all hardcoded strings in the target file. Ignore:

  • Console logs
  • Comments
  • Dynamic values without context

Step 2: Generate Keys

Create semantic, hierarchical keys using the page.section.element.state pattern. BAD: common.title GOOD: settings.profile.submitButton.loading

Step 3: Replace Code

Replace the strings with t('key') hook. Ensure useTranslation hook is imported.

Step 4: Update JSON (CRITICAL)

You MUST generate the JSON update block for src/locales/en.json (and other languages if provided).


Resources

Scripts

  • scripts/scan_strings.py: Python script to automatically scan files for hardcoded strings
    • Usage: python scripts/scan_strings.py <file_path>
    • Output: List of strings with suggested i18n keys

Assets

  • assets/locale-template.json: Standard JSON structure for locale files
    • Use this template to maintain consistency across all language files

Example

User: Refactor src/pages/Login.tsx

Assistant:

Step 1: Identified Strings

  • "Welcome back"
  • "Please enter your details"

Step 2: Proposed Keys

  • login.header.title: "Welcome back"
  • login.header.subtitle: "Please enter your details"

Step 3: Code Refactor

// src/pages/Login.tsx
import { useTranslation } from "react-i18next";

export const Login = () => {
  const { t } = useTranslation();
  return (
    <div>
      <h1>{t("login.header.title")}</h1>
      <p>{t("login.header.subtitle")}</p>
    </div>
  );
};

Step 4: JSON Updates

// src/locales/en.json
{
  "login": {
    "header": {
      "title": "Welcome back",
      "subtitle": "Please enter your details"
    }
  }
}

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です