Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LRC-LIB-SMARTCOLL: document message contexts for translators

Nathaniel Ledford451e3cd28c79
diff --git a/docs/localization-ja.md b/docs/localization-ja.md
index bcfb8a8dd..b92a444e0 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 123dcaba8..f82529a9e 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 `"<context>|<English>"`, 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: