Add a third UI language

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Start with the suggested first pull request: read packages/scene/src/focus.ts and the site language toggles in apps/site/src/playground/main.ts, apps/site/src/landing/main.ts, and apps/site/src/shared/prefs.ts. Remove assumptions that only two locales exist, then check how locale selection behaves across the CLI, viewer, and site. The full change is done when a third locale works in the CLI and viewer, tests cover translated keys, docs/faq.md is updated, and a changeset is added.

Written by the indexing model from the issue text.

Description

help wanted i18n
Why

kgdiff speaks English and Simplified Chinese: the CLI, the HTML reports, the viewer, the
GitHub Action comment and the website. A third language is a good way to make kgdiff feel at
home for more people, and adding it will also make the code ready for a fourth.

If you are a native speaker of Japanese, Korean, German, French, Spanish, Portuguese or
another language and would like to translate, comment with the language.
One language per
pull request.

What has to change

The locale is a closed union today, and a few places assume there are exactly two:

Where What
core types.ts#L64 type Locale = 'en' | 'zh-CN'
core i18n.ts#L353 phrasebooks for hunk titles and change descriptions (the largest part: whole sentences with plurals and quoted names)
viewer i18n.ts#L386 viewer UI strings, LOCALES, locale matching
cli locale.ts#L10 CLI messages, LOCALES, matching LANG
action/lib.mjs#L25 the pull request comment
scene focus.ts#L59 a hard-coded zh-CN branch for the "+38 unchanged" pill
viewer popovers.ts#L68 the language menu
playground main.ts#L765, landing main.ts#L328, prefs.ts#L32 the site's language toggle flips between two languages
Suggested order
  1. A first pull request with no translation in it: remove the two-language assumptions (the
    focus.ts branch, the site toggles) so that adding a locale means adding tables. This part
    is a good first contribution on its own.
  2. Then the translation: CLI and viewer strings first, core phrasebook (hunk titles) next.
    The website and the docs can follow later, or never: the tool matters more.
Done when
  • --locale <xx> in the CLI and locale="xx" on <kgdiff-viewer> work, with tests next to
    the existing i18n.test.ts files that check every key is translated.
  • docs/faq.md ("Which languages does kgdiff speak?") updated, and a changeset.
Dominant language
TypeScript
Stars
47
Forks
6
Avg merge
2h 32m
Merged PRs (30d)
22

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from iiwish/kgdiff

All issues in iiwish/kgdiff

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.