apache / apache/maka

feat(i18n): assign the locale paths outside UiCatalog<T> before ko integration

Open
#5,075 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
5.4k
Forks
502
Avg merge
1d 2h
Merged PRs (30d)
706

Description

### Problem

Per @me2seeks's delivery decision on #3975: "Please also assign the type-invisible locale paths before integration, especially the E2E/Storybook locale globals and hardcoded locale branches, so `ko` cannot compile while silently rendering English."

Those paths are not covered by the 126 `UiCatalog` sites counted on #3975, and they split into two classes with different failure modes.

## Class A — compiles clean, renders English

These pass typecheck with `ko` enabled and silently serve English, so nothing reports them.

| Path | Shape |
|---|---|
| `apps/desktop/src/main/e2e-fixture.ts` (`parseLocaleFlag`) | no `ko` branch — returns `null` |
| `apps/desktop/src/main/browser-message-box.ts` | locale ternary |
| `apps/desktop/src/renderer/workhub-surface.ts` | locale ternary / if-chain |
| `apps/desktop/src/renderer/settings/daily-review-settings-page.ts` | hardcoded union instead of `UiLocale` |
| `apps/desktop/e2e/fixtures.ts` | hardcoded union instead of `UiLocale` |
| `apps/desktop/.storybook/preview.ts` and stories | no `ko` in the locale global |

I catalogued these on #3975 against `c0229b0` and re-verified the paths today. The line numbers in that comment have drifted, so they are omitted here deliberately — search for the shape, not the line.

One entry did not survive re-verification: a locale if-chain in `renderer/features/connection-settings/subscription-result-message.ts`. No such file exists under `apps/desktop/src/renderer/features/connection-settings/` at current `main`, so it was renamed or moved rather than fixed. It should be re-located, not assumed gone.

`parseLocaleFlag` is the same class @Astro-Han caught for `zh-TW` in #3853, which is the argument for tracking this once rather than rediscovering it per locale.

## Class B — hard failures, but uncounted

Plain `as const` locale maps indexed with a `UiLocale`. They are not declared as `UiCatalog`, so they are absent from the census, and they only fail once `ko` is in the union. From run 34312890700 on `36a4377` (#5011) — all `TS7053`, all in `maka-agent` (`packages/cli`):

- `src/pi-tui-todo.ts:131,188,217`
- `src/pi-tui-transcript-viewer.ts:208`
- `src/pi-tui-runner.ts:4005`
- `src/__tests__/tui-copy-catalog.test.ts:59`

Six is a floor, not a total. That run ends with `tsc -p tsconfig.json` failing in `packages/cli` with exit code 2, so any workspace built after it was never reached — whatever equivalents exist in `@maka/ui` and `@maka/desktop` are still unmeasured.

### Desired outcome

Every path above has an owner before the maintainer-owned integration branch is cut, so `ko` cannot ship compiling-but-English.

Proposed homes, for @me2seeks to confirm or overrule:

- `parseLocaleFlag` and `apps/desktop/e2e/fixtures.ts` → #3980 (native surfaces and E2E fixtures)
- the `packages/cli` Class B sites → #3979 / #4349
- the renderer ternaries and hardcoded unions → #3977 and the slice-2 work
- `apps/desktop/src/main/browser-message-box.ts` → closest to #3978's main-process fallback bucket, though it is not listed there today
- `apps/desktop/.storybook/preview.ts` and the stories → not owned by any slice today

Acceptance criteria:

- Every Class A path either renders `ko` or is deliberately recorded as English-only.
- Every Class B map carries `ko`, or is re-typed so a missing locale is a typecheck error rather than an implicit `any`.
- A full repo typecheck with `ko` enabled reports zero locale-related errors.
- The `as const` maps in `@maka/ui` and `@maka/desktop` are enumerated once the CLI gap no longer blocks the build.
- The relocated `subscription-result-message` if-chain is found and assigned, or recorded as no longer existing.

Refs #3975, #5011. Part of #3974.

### Alternatives or workarounds

Leave them where they are. `ko` would then ship with English islands in the desktop main process, the workhub surface, the daily-review settings page, the E2E fixtures and Storybook, none of which any check would report — and the catalog census would stay wrong by however many `as const` maps exist outside `packages/cli`.

Fold each path into whichever slice happens to touch it. That is roughly what happened for `zh-TW`: `parseLocaleFlag` was caught in review on #3853 rather than by a check, and the same shape is back here for `ko`. Tracking the class once is what keeps the next locale from paying for it a third time.

Contributor guide

Open the contributing guide

Research direction

Start with the Class A paths in apps/desktop/src/main/e2e-fixture.ts, browser-message-box.ts, workhub-surface.ts, daily-review-settings-page.ts, apps/desktop/e2e/fixtures.ts, and .storybook/preview.ts, then inspect the Class B files under packages/cli/src. Run the packages/cli typecheck and locate the moved subscription-result-message chain. Done means all listed paths handle or record ko deliberately and the full typecheck reports no locale errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
storybook, typescript
Domain
cli, desktop-dev, internationalization, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.