This commit is contained in:
Brandon Thomas
2026-10-23 10:11:12 -04:00
+163 -1
View File
@@ -980,10 +980,160 @@ pub(super) const DIALOGS: &[(&str, &str)] = &[
("Unprotect Sheet…", "シート保護の解除…"),
];
/// Labels of the ribbon menus, pop-ups and palettes that the reference catalog does not cover (the
/// Portuguese catalog has no entry for them either). Kept apart so the two catalogs above keep the
/// same key set; it never overlaps them.
pub(super) const EXTRA: &[(&str, &str)] = &[
("Cut (⌘X)", "切り取り (⌘X)"),
("Copy (⌘C)", "コピー (⌘C)"),
("Bold (⌘B)", "太字 (⌘B)"),
("Italic (⌘I)", "斜体 (⌘I)"),
("Underline (⌘U)", "下線 (⌘U)"),
("AutoSum (⌘⇧T)", "オート SUM (⌘⇧T)"),
("Filter (⌘⇧F)", "フィルター (⌘⇧F)"),
("Flash Fill (⌘E)", "フラッシュ フィル (⌘E)"),
("Insert Link (⌘K)", "リンクの挿入 (⌘K)"),
("Paste (⌘V)", "貼り付け (⌘V)"),
("Redo (⌘Y)", "やり直し (⌘Y)"),
("Save (⌘S)", "上書き保存 (⌘S)"),
("Search commands (⌘⇧Space)", "コマンドの検索 (⌘⇧Space)"),
("Table (⌘T)", "テーブル (⌘T)"),
("Undo (⌘Z)", "元に戻す (⌘Z)"),
("New Workbook", "新しいブック"),
("Save As…", "名前を付けて保存…"),
("Print…", "印刷…"),
("Export as PDF…", "PDF としてエクスポート…"),
("Save a Copy as Excel Workbook (.xlsx)…", "Excel ブック (.xlsx) としてコピーを保存…"),
("Export as CSV…", "CSV としてエクスポート…"),
("Export as Web Page (.html)…", "Web ページ (.html) としてエクスポート…"),
("Bottom Border", "下罫線"),
("Top Border", "上罫線"),
("Left Border", "左罫線"),
("Right Border", "右罫線"),
("No Border", "枠なし"),
("All Borders", "格子"),
("Outside Borders", "外枠"),
("Thick Outside Borders", "太い外枠"),
("Bottom Double Border", "下二重罫線"),
("Thick Bottom Border", "下太罫線"),
("Top and Bottom Border", "上下罫線"),
("Top and Thick Bottom Border", "上罫線 + 下太罫線"),
("Top and Double Bottom Border", "上罫線 + 下二重罫線"),
("Inside Borders", "内側罫線"),
("More Borders…", "その他の罫線…"),
("More Functions…", "その他の関数…"),
("No Fill", "塗りつぶしなし"),
("Theme Colors", "テーマの色"),
("Standard Colors", "標準の色"),
("Highlight Cells Rules", "セルの強調表示ルール"),
("Greater Than…", "指定の値より大きい…"),
("Less Than…", "指定の値より小さい…"),
("Between…", "指定の範囲内…"),
("Equal To…", "指定の値に等しい…"),
("Text that Contains…", "文字列…"),
("A Date Occurring…", "日付…"),
("Duplicate Values…", "重複する値…"),
("Top/Bottom Rules", "上位/下位ルール"),
("Blue", "青"),
("Green", "緑"),
("Red", "赤"),
("Orange", "オレンジ"),
("Light Blue", "水色"),
("Purple", "紫"),
("Green - Yellow - Red", "緑 - 黄 - 赤"),
("Red - Yellow - Green", "赤 - 黄 - 緑"),
("Green - White - Red", "緑 - 白 - 赤"),
("Blue - White - Red", "青 - 白 - 赤"),
("White - Green", "白 - 緑"),
("White - Red", "白 - 赤"),
("3 Arrows", "3 つの矢印"),
("3 Traffic Lights", "3 つの信号"),
("3 Symbols", "3 つの記号"),
("4 Ratings", "4 段階評価"),
("5 Arrows", "5 つの矢印"),
("5 Quarters", "5 つの四分円"),
("New Rule…", "新しいルール…"),
("Clear Rules", "ルールのクリア"),
("Manage Rules…", "ルールの管理…"),
("Good, Bad and Neutral", "良い、悪い、どちらでもない"),
("Bad", "悪い"),
("Good", "良い"),
("Neutral", "どちらでもない"),
("Data and Model", "データとモデル"),
("Calculation", "計算"),
("Check Cell", "チェック セル"),
("Explanatory Text", "説明文"),
("Input", "入力"),
("Linked Cell", "リンク セル"),
("Note", "メモ"),
("Output", "出力"),
("Warning Text", "警告文"),
("Titles and Headings", "タイトルと見出し"),
("Heading 1", "見出し 1"),
("Heading 2", "見出し 2"),
("Heading 3", "見出し 3"),
("Heading 4", "見出し 4"),
("Total", "集計"),
("Themed Cell Styles", "テーマのセルのスタイル"),
("Number Format", "表示形式"),
("Comma [0]", "桁区切り [0]"),
("Currency [0]", "通貨表示形式 [0]"),
("Percent", "パーセント"),
("Place in Cell", "セル内に配置"),
("Place over Cells", "セルの上に配置"),
("Rectangle", "四角形"),
("Rounded Rectangle", "角丸四角形"),
("Oval", "楕円"),
("Triangle", "三角形"),
("Arrow", "矢印"),
("Column", "縦棒"),
("Win/Loss", "勝敗"),
("Type to filter…", "入力して絞り込み…"),
("Sort Ascending", "昇順"),
("Sort Descending", "降順"),
("Search", "検索"),
("Apply", "適用"),
("20% - Accent1", "20% - アクセント 1"),
("20% - Accent2", "20% - アクセント 2"),
("20% - Accent3", "20% - アクセント 3"),
("20% - Accent4", "20% - アクセント 4"),
("20% - Accent5", "20% - アクセント 5"),
("20% - Accent6", "20% - アクセント 6"),
("40% - Accent1", "40% - アクセント 1"),
("40% - Accent2", "40% - アクセント 2"),
("40% - Accent3", "40% - アクセント 3"),
("40% - Accent4", "40% - アクセント 4"),
("40% - Accent5", "40% - アクセント 5"),
("40% - Accent6", "40% - アクセント 6"),
("60% - Accent1", "60% - アクセント 1"),
("60% - Accent2", "60% - アクセント 2"),
("60% - Accent3", "60% - アクセント 3"),
("60% - Accent4", "60% - アクセント 4"),
("60% - Accent5", "60% - アクセント 5"),
("60% - Accent6", "60% - アクセント 6"),
("Accent1", "アクセント 1"),
("Accent2", "アクセント 2"),
("Accent3", "アクセント 3"),
("Accent4", "アクセント 4"),
("Accent5", "アクセント 5"),
("Accent6", "アクセント 6"),
("Recent Colors", "最近使用した色"),
("More Colors…", "その他の色…"),
("Hex", "16進"),
("Page Break Preview", "改ページ プレビュー"),
("Bubble", "バブル"),
("Box & Whisker", "箱ひげ図"),
("Treemap", "ツリーマップ"),
("Sunburst", "サンバースト"),
("Stock", "株価"),
("Bar", "横棒"),
("Drag to fill cells. Drag from inside a cell to select a range.", "ドラッグしてセルを塗りつぶします。セルの内側からドラッグすると範囲を選択します。"),
];
/// Translates an interface label; `None` for a label the catalog does not know, so `i18n.rs` can
/// fall back to English. Dialog strings come first, the shared core second.
pub(super) fn translate(text: &str) -> Option<&'static str> {
DIALOGS.iter().chain(CORE).find(|(english, _)| *english == text).map(|(_, translated)| *translated)
DIALOGS.iter().chain(CORE).chain(EXTRA).find(|(english, _)| *english == text).map(|(_, translated)| *translated)
}
#[cfg(test)]
@@ -1088,6 +1238,18 @@ mod tests {
assert_eq!(catalog_keys().count(), 954);
}
#[test]
fn extra_labels_are_translated_and_do_not_overlap_the_catalog() {
let catalog: HashSet<&str> = catalog_keys().collect();
let mut seen = HashSet::new();
for (english, japanese) in EXTRA {
assert!(!japanese.trim().is_empty(), "empty translation for {english:?}");
assert!(!catalog.contains(english), "{english:?} is already in CORE or DIALOGS");
assert!(seen.insert(*english), "duplicate EXTRA key: {english:?}");
assert_eq!(translate(english), Some(*japanese));
}
}
#[test]
fn covers_every_key_the_portuguese_catalog_translates() {
let portuguese = portuguese_keys();