smithery.ai

i18n-refactor

Automated workflow to refactor Angular components for i18n with namespaced JSON. It extracts strings, updates HTML/TS files, injects TranslateService, and generates nested en/tc translation objects.

First seen Apr 6, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.1.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,657 B
  • docs SUMMARY.md 219 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Angular i18n Refactoring Skill (Namespaced)

Use this skill to systematically refactor Angular components for internationalization (ngx-translate) using a nested JSON structure (Namespaces).

workflow

1. Scan and Extract

  • Analyze the user-selected HTML file.
  • Determine the Namespace based on the component name (e.g., UserProfileComponent -> USER_PROFILE).
  • Identify all hardcoded text nodes and static attributes (specifically placeholder, title, alt, aria-label).
  • Generate keys nested under the namespace in UPPERSNAKECASE (e.g., Namespace: USERPROFILE, Key: SUBMITBTN).

2. Template Refactoring (HTML)

  • Replace text content with the pipe syntax using dot notation: {{ 'NAMESPACE.KEY' | translate }}.

- Example: {{ 'USERPROFILE.SUBMITBTN' | translate }}

  • Replace attributes with bound syntax: [placeholder]="'NAMESPACE.KEY' | translate".

3. Component Dependency Injection (TS)

  • Locate the corresponding .ts file.
  • Check Imports: Ensure import { TranslateService } from '@ngx-translate/core'; exists.
  • Check Injection: Verify if TranslateService is injected.

- If missing, add: private translate = inject(TranslateService); (Use constructor injection for older Angular versions).

4. Translation Generation (JSON)

  • Locate src/assets/i18n/en.json and src/assets/i18n/tc.json.
  • Structure: Create or update the JSON with nested objects, not flat keys.

Example Structure: "USERPROFILE": { "SUBMITBTN": "Submit", "CANCEL_BTN": "Cancel" }

  • English (en.json): Add the nested keys with original text.
  • Traditional Chinese (tc.json): Auto-translate text to Traditional Chinese (Hong Kong style, zh-HK) and maintain the same nested structure.

5. Final Reporting

  • Output a markdown table summary of the changes:
Key ID English (en.json) Chinese (tc.json)
USERPROFILE.SUBMITBTN "Submit" "提交"

Guidelines

  • Strictly maintain JSON nesting. Do not create keys like "USERPROFILE.SUBMITBTN": "...". It must be "USERPROFILE": { "SUBMITBTN": "..." }.
  • Prioritize "Hong Kong" terminology for tc.json (e.g., use "登入" for Login, not "登錄").
  • If the translation files are not in context, ask the user for their location.