feat(installer): add --locale flag for translated docs installation

Adds `--locale <code>` support to the ECC installer so users can install
localized reference docs (agents, commands, skills, rules) into
`~/.claude/docs/<locale>/` alongside the existing English installation.

Changes:
- manifests/install-modules.json: add 8 locale doc modules (docs-ja-JP,
  docs-zh-CN, docs-ko-KR, docs-pt-BR, docs-ru, docs-tr, docs-vi-VN,
  docs-zh-TW), each with kind="docs" and defaultInstall=false
- manifests/install-components.json: add 8 locale: components mapping to
  the new modules
- scripts/lib/install-manifests.js: add locale: family prefix,
  SUPPORTED_LOCALES, LOCALE_ALIAS_TO_COMPONENT_ID (with aliases like
  ja=ja-JP, zh=zh-CN, ko=ko-KR), and listSupportedLocales()
- scripts/lib/install/request.js: add --locale flag to parseInstallArgs(),
  resolve locale alias → component ID in normalizeInstallRequest(), throw
  on unsupported locale codes
- scripts/lib/install-targets/claude-home.js: map docs/<locale>/ source
  paths to ~/.claude/docs/<locale>/ destination (side-by-side, no overwrite
  of English files)
- scripts/install-apply.js: import listSupportedLocales, add --locale
  usage line and available locales list to --help output

Usage examples:
  ./install.sh --locale ja                    # Japanese docs only
  ./install.sh --profile core --locale zh-CN  # core profile + zh-CN docs
  ./install.sh typescript --locale ja         # legacy + locale (errors)
This commit is contained in:
Claude
2026-05-18 07:57:10 +09:00
committed by Affaan Mustafa
parent 519c592a12
commit 71aedad889
6 changed files with 234 additions and 2 deletions

View File

@@ -12,7 +12,28 @@ const COMPONENT_FAMILY_PREFIXES = {
capability: 'capability:',
agent: 'agent:',
skill: 'skill:',
locale: 'locale:',
};
const SUPPORTED_LOCALES = Object.freeze(['ja', 'zh-CN', 'ko-KR', 'pt-BR', 'ru', 'tr', 'vi-VN', 'zh-TW']);
const LOCALE_ALIAS_TO_COMPONENT_ID = Object.freeze({
'ja': 'locale:ja',
'ja-JP': 'locale:ja',
'zh-CN': 'locale:zh-CN',
'zh': 'locale:zh-CN',
'ko-KR': 'locale:ko-KR',
'ko': 'locale:ko-KR',
'pt-BR': 'locale:pt-BR',
'pt': 'locale:pt-BR',
'ru': 'locale:ru',
'tr': 'locale:tr',
'vi-VN': 'locale:vi-VN',
'vi': 'locale:vi-VN',
'zh-TW': 'locale:zh-TW',
});
function listSupportedLocales() {
return [...SUPPORTED_LOCALES];
}
const LEGACY_COMPAT_BASE_MODULE_IDS_BY_TARGET = Object.freeze({
claude: [
'rules-core',
@@ -607,11 +628,14 @@ function resolveInstallPlan(options = {}) {
module.exports = {
DEFAULT_REPO_ROOT,
SUPPORTED_INSTALL_TARGETS,
SUPPORTED_LOCALES,
LOCALE_ALIAS_TO_COMPONENT_ID,
getManifestPaths,
loadInstallManifests,
getInstallComponent,
listInstallComponents,
listLegacyCompatibilityLanguages,
listSupportedLocales,
listInstallModules,
listInstallProfiles,
resolveInstallPlan,