This commit is contained in:
bflatastic
2026-10-13 11:03:01 +07:00
4 changed files with 22 additions and 7 deletions
+1 -1
View File
@@ -215,7 +215,7 @@ fn right_side(app: &mut LightcraftApp, ui: &mut egui::Ui, full: Rect, compact_zo
("200%", Zoom::Percent(200.0)),
("400%", Zoom::Percent(400.0)),
] {
if ui.selectable_label(app.ui.zoom == z, label).clicked() {
if ui.selectable_label(app.ui.zoom == z, crate::i18n::tr(label)).clicked() {
app.ui.zoom = z;
app.ui.pan = (0.5, 0.5);
}
+1 -1
View File
@@ -801,7 +801,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
resp.context_menu(|ui| {
ui.menu_button(crate::i18n::tr("Zoom"), |ui| {
for (label, cmd) in [("Fit", "view.zoomFit"), ("100%", "view.zoom100"), ("Zoom In", "view.zoomIn"), ("Zoom Out", "view.zoomOut")] {
if ui.button(label).clicked() {
if ui.button(crate::i18n::tr(label)).clicked() {
let _ = app.run(cmd, json!({}));
}
}
+18 -3
View File
@@ -1024,7 +1024,7 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
});
ui.menu_button(crate::i18n::tr("Set Flag"), |ui| {
for (l, f) in [("Pick", "pick"), ("Reject", "reject"), ("Unflagged", "none")] {
if ui.button(l).clicked() {
if ui.button(crate::i18n::tr(l)).clicked() {
let _ = app.run("photo.flag", json!({"flag": f}));
}
}
@@ -1113,7 +1113,7 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
("Split Stack", "stack.split", stacked),
("Expand/Collapse Stack", "stack.toggle", stacked),
] {
if ui.add_enabled(on, egui::Button::new(label)).clicked() {
if ui.add_enabled(on, egui::Button::new(crate::i18n::tr(label))).clicked() {
let _ = app.run(cmd, json!({}));
}
}
@@ -1138,7 +1138,7 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
ui.menu_button(crate::i18n::tr("Photo Merge"), |ui| {
let n = app.session.targets(&json!({})).len();
for (id, label) in [("dialog.mergeHdr", "HDR…"), ("dialog.mergePanorama", "Panorama…"), ("dialog.mergeHdrPanorama", "HDR Panorama…")] {
if ui.add_enabled(n >= 2, egui::Button::new(label)).clicked() {
if ui.add_enabled(n >= 2, egui::Button::new(crate::i18n::tr(label))).clicked() {
let _ = app.run(id, json!({}));
}
}
@@ -1280,6 +1280,21 @@ mod tests {
}
}
#[test]
fn library_context_menu_labels_have_french_translations() {
let saved = crate::i18n::language();
crate::i18n::set_language(crate::i18n::Locale::Fr);
for (label, expected) in [
("Pick", "Sélectionnée"),
("Reject", "Rejeter"),
("Group into Stack", "Regrouper en pile"),
("HDR Panorama…", "Panorama HDR…"),
] {
assert_eq!(crate::i18n::tr(label), expected);
}
crate::i18n::set_language(saved);
}
#[test]
fn square_grid_groups_and_auto_levels() {
let l = layout(&[1.0; 5], &[(0, 3), (3, 2)], 400.0, 100.0, true);
+2 -2
View File
@@ -141,7 +141,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
let fresp = fresp.on_hover_text(if active > 0 {
crate::i18n::tr_format!("Filter bar — {active} active filter{}", if active == 1 { "" } else { "s" }, active = active)
} else {
"Filter bar".into()
crate::i18n::tr("Filter bar").into()
});
if fresp.clicked() {
let _ = app.run("view.filterBar", json!({}));
@@ -167,7 +167,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
("bell", Icon::Bell, "Activity", "panel.activity"),
] {
let r = Rect::from_center_size(pos2(x, full.center().y), vec2(28.0, 28.0));
let resp = ui.interact(r, egui::Id::new(("top", id)), Sense::click()).on_hover_text(tip);
let resp = ui.interact(r, egui::Id::new(("top", id)), Sense::click()).on_hover_text(crate::i18n::tr(tip));
register(ui.ctx(), format!("icon:{id}"), r);
let warn = id == "cloud" && unsaved.is_some();
let colour = if warn {