カードの背景と配色の名前を辞書へ移す (#475) - #477
Merged
Merged
Conversation
プロフィールカードの背景パターンと配色テーマの呼び名が、配色カタログ (cardTheme.ts) に日本語で直に書かれていた。英語で見ている人にも 「ロゼット」「インディゴ」がそのまま出る。 カタログが持つのは引き先の辞書キーだけにして、表示名は profile 辞書 (1ファイル=1領域=1名前空間) に ja と en を隣り合わせで置く。キーの綴りは `profile.cardBg*` / `profile.cardTheme*` に絞った型で縛ってあるので、 辞書に無いキーを書くと typecheck が落ちる。 描く側の契約 (CardTheme) は色だけのまま。呼び名はピッカーしか使わないので、 選択肢の型 (CardThemeChoice) に足した。カードの絵は変えていない。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SLkuubF8cHzSnnsv4fN9DA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
何が起きていたか
プロフィールカードのピッカーに出る背景パターン・配色テーマの呼び名が、配色カタログ
apps/web/src/components/licenseCard/cardTheme.tsに日本語で直に書かれていた。英語で画面を見ている人にも「ロゼット」「インディゴ」がそのまま出る。#474 の作業中に見つけて、描画文言が変わるので分けたもの。何を動かしたか
packages/shared/src/i18n/messages/profile.tsへ。カードの他の文言(cardAriaLabelcardOwnHint)と同じ領域=同じ名前空間で、ja と en を隣り合わせに置いた。labelKey/nameKey)。キーの型はprofile.cardBg*/profile.cardTheme*に絞ってあるので、辞書に無いキーや綴り違いは typecheck で落ちる(実際にcardBgTopooへ差し替えて 2 件のエラーが出ることを確かめた)。CardThemeからはnameを外した。呼び名を使うのはピッカーだけなので、選択肢の型CardThemeChoiceに足してある。LicenseCardPage.tsx)がt()で引くようにした。日本語の文言は 1 文字も変えていない。
ja → en
色と模様の呼び名なので、直訳ではなくその言語で通じる言い方にした。「等高線」は地図の等高線なので Contours、「流線」は流れる線の意匠なので Flow。
カードの絵が変わっていないこと
#474 と同じやり方で、12 のデータ形 × 5 配色 × 4 背景 = 240 通りを変更前と変更後で描き比べた。データ形はアイコン無し・長い和名・長い欧文名・ハンドル無し・実績ゼロ・コミュニティ 1/5/9 件・バッジ複数・絵文字名などを含む。
退行の見張り
apps/web/src/components/licenseCard/cardTheme.test.ts(新規): カタログの項目が表示用の文字列を持たないこと(label/nameの復活で落ちる)、引き先のキーが ja と en の両方にあること、呼び名を使い回していないこと。apps/web/src/pages/LicenseCardPage.test.tsx: 英語に切り替えてページを描き、チップが Rosette / Contours / Indigo / Monochrome になり日本語が出ないことを確かめる。直書きに戻すとここが落ちる。確認
pnpm -r typecheck3 プロジェクトとも通過LicenseCardPage.tsx440 行)Closes #475
🤖 Generated with Claude Code
https://claude.ai/code/session_01SLkuubF8cHzSnnsv4fN9DA