Skip to content

feat(cli): add --locale and deprecate --lang ko|en - #68

Merged
amondnet merged 2 commits into
mainfrom
amondnet/65-locale-flag
Oct 23, 2026
Merged

amondnet merged 2 commits into
mainfrom
amondnet/65-locale-flag

Conversation

@amondnet

@amondnet amondnet commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a global --locale <ko|en> flag for the output language and starts retiring --lang ko|en. --lang is reserved for a future programming-language selection, so its old meaning must not keep working silently. Previously a non-strict parseArgs ignored unknown values and fell back to $LANG.

  • --locale <ko|en> is a global flag (packages/cli/src/index.ts, resolveLocaleFlags in src/i18n.ts). check accepts it too (src/check/run-check.ts).
  • --lang ko|en still sets the locale but prints a deprecation warning that points at --locale, for one minor release. --locale wins when both are given.
  • Any other --lang value, --lang without a value, or an unknown --locale value exits 1 with an error.
  • Help text (both locales), packages/cli/README.md, README.ko.md, and apps/docs cli.mdx (en/ko) use --locale and describe the transition.

Scope and notes for reviewers

Verification

  • bun test in packages/cli: 261 pass / 1 skip / 0 fail. New: 5 unit tests for resolveLocaleFlags (test/i18n.test.ts) and 3 subprocess tests (test/index.test.ts).
  • tsc --noEmit and eslint clean; docs astro build and lint:docs clean (22 files).
  • Manual runs: --lang ko|en|foo, bare --lang, --locale ko|fr, --locale en --lang ko, check --locale ko.

Related issue

Refs #65

Checklist

  • PR title follows Conventional Commits
  • Packages build (bun run build)
  • Lint/format pass (bun run lint)
  • Documentation updated if behavior changed
  • No breaking change, or a BREAKING CHANGE: note is included

Summary by cubic

Adds a global --locale <ko|en> flag to select the CLI output language and deprecates --lang ko|en. --lang is reserved for future programming-language selection, so unknown values that were previously ignored now fail instead of silently falling back to $LANG. The migration path is documented in both locales' READMEs and docs.

Migration

  • --lang ko|en still sets the locale for one minor release and prints a deprecation warning pointing at --locale.
  • --locale wins when both flags are given; --lang then prints an "ignored" warning telling the user to remove it, so it is not mistaken for the migration target.
  • Any other --lang value, a bare --lang, or an unknown --locale value exits 1.

Written for commit 7fd6040. Summary will update on new commits.

Turn on auto-fix

Demo

--locale ko help, --lang ko deprecation warning, and unknown --lang/--locale values exiting 1

Add a --locale <ko|en> flag that selects the output language. Docs and
READMEs now use --locale.

--lang ko|en still sets the locale for now but prints a deprecation
warning, and this transition lasts one minor release. Any other --lang
value, or an unknown --locale value, exits 1 with an error instead of
being silently ignored. This keeps the planned programming-language
meaning of --lang from ever applying silently.

Refs #65
@codacy-production

codacy-production Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 31 complexity · 2 duplication

Metric Results
Complexity 31
Duplication 2

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the --lang flag with --locale for setting the CLI locale, while maintaining backward compatibility for --lang with a deprecation warning. It introduces a robust resolveLocaleFlags utility to handle locale configuration, adds validation for locale values, and updates documentation and tests accordingly. I have no feedback to provide.

@amondnet
amondnet marked this pull request as ready for review October 23, 2026 09:40

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/docs/src/content/docs/en/cli.mdx Outdated
Comment thread apps/docs/src/content/docs/ko/cli.mdx Outdated
Comment thread packages/cli/README.ko.md Outdated
Comment thread packages/cli/src/i18n.ts Outdated
Comment thread packages/cli/src/i18n.ts Outdated
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes appear safe to merge.

Summary

Adds --locale and keeps --lang ko|en temporarily, with a warning.

  • CLI users choose the message language with --locale.

Reviews (2) · Last reviewed commit: "chore(cli): apply AI code review suggest..." · Reviewed by Greptile

- Warn that --lang is ignored, not that it is the migration target, when
  --locale overrides it
- Fix the Korean particles in the --lang deprecation message
- Describe the current --lang/--locale error behavior and precedence in docs

Refs #65
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Deploying code-style with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7fd6040
Status: ✅  Deploy successful!
Preview URL: https://6fbad627.code-style.pages.dev
Branch Preview URL: https://amondnet-65-locale-flag.code-style.pages.dev

View logs

@sonarqubecloud

Copy link
Copy Markdown

@amondnet
amondnet merged commit 8a7ca6d into main Oct 23, 2026
13 checks passed
@amondnet
amondnet deleted the amondnet/65-locale-flag branch October 23, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant