From 451e3cd28c79f30e8cdf94342dc4540c6b0ca433 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Fri, 9 Oct 2026 07:49:50 -0400 Subject: [PATCH] LRC-LIB-SMARTCOLL: document message contexts for translators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit localization.md explains "|" catalog keys and the one context today (smart album value); localization-ja.md notes あり / なし. Co-Authored-By: Claude Opus 5.5 --- docs/localization-ja.md | 4 ++++ docs/localization.md | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/localization-ja.md b/docs/localization-ja.md index bcfb8a8d..b92a444e 100644 --- a/docs/localization-ja.md +++ b/docs/localization-ja.md @@ -24,5 +24,9 @@ LightCraft は日本語・簡体字中国語・英語(English)の表示に 英語の単複数語尾を日本語で省略する場合、対応する文字列引数は `{:.0}` で空にします。 `LIGHTCRAFT_LANGUAGE=ja lightcraft-cli snapshot ...` で日本語の画面を描画できます。 +スマートアルバムの「はい/いいえ」で答える条件(編集あり、切り抜き済みなど)の値は、文脈付きキー +`"smart album value|Yes"`・`"smart album value|No"` で「あり/なし」と表示します。共有の +`"Yes"`・`"No"`(はい/いいえ)は他の画面でそのまま使います([`localization.md`](localization.md) の文脈の説明を参照)。 + 表示・フォント・言語の切り替え・設定の保存・コマンドIDの保持は `cargo test -p lightcraft-ui-egui i18n::tests` で検証します(グリフの検査は `CRAFT_FONTS_DIR` 指定時のみ実行)。 diff --git a/docs/localization.md b/docs/localization.md index 123dcaba..f82529a9 100644 --- a/docs/localization.md +++ b/docs/localization.md @@ -49,6 +49,14 @@ are in [`localization-zh-hans.md`](localization-zh-hans.md), [`localization-zh-h text unchanged when there is no entry; `tr_format!` handles text with runtime values. Both are presentation-only: command ids, file names and user-entered metadata are never translated. +A few messages take a **context**, for a word whose shared translation reads wrongly in one place. +The catalog may then carry `"|"`, which wins there; without it the plain message +is used, so only the languages that need it add one. Today the one context is `smart album value`: +the Yes / No of a yes/no rule (Has Edits, Cropped…). Japanese uses it because はい / いいえ answer a +question rather than describe a photo (`"smart album value|Yes": "あり"`, `"smart album value|No": +"なし"`); every other language uses its plain Yes / No. A contextual key that names no real value +fails the i18n tests. + `tr_format!` is generated by `crates/ui-egui/build.rs`: one arm per English message, which formats the active language's translation with `format!` (English is the fallback arm). Every catalog's format string is therefore checked by Rust against the call site's own arguments: