feat(i18n): complete Japanese localization and eliminate UI hardcoded strings (#753)

Completes the Japanese catalog (all commands, panels, dialogs and preferences) and routes the remaining hard-coded UI labels through the translation lookup. English stays the default.
This commit is contained in:
Mithril_MEX authored and GitHub committed 2026-10-13 13:24:24 -04:00
1 parent a8b3b21fd0
commit d437c21368
35 files changed
+2219 -265

No files matched your search

+17 -12
View File
@@ -166,14 +166,18 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
{
{
ui.horizontal(|ui| {
ui.add(egui::TextEdit::singleline(&mut app.keymap.filter).hint_text("Filter commands or keys").desired_width(300.0));
if !app.keymap.read_only && ui.button("Reset All").clicked() {
ui.add(
egui::TextEdit::singleline(&mut app.keymap.filter)
.hint_text(crate::i18n::tr_label("Filter commands or keys"))
.desired_width(300.0),
);
if !app.keymap.read_only && ui.button(app.tr_label("Reset All")).clicked() {
action = Some((String::new(), "reset_all"));
}
if ui.button("Export…").on_hover_text("Keys, S box favourites and the toolbar, as a file").clicked() {
if ui.button(app.tr_label("Export…")).on_hover_text(app.tr_label("Keys, S box favourites and the toolbar, as a file")).clicked() {
action = Some((String::new(), "export"));
}
if !app.keymap.read_only && ui.button("Import…").clicked() {
if !app.keymap.read_only && ui.button(app.tr_label("Import…")).clicked() {
action = Some((String::new(), "import"));
}
});
@@ -185,14 +189,14 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
if ui.button(format!("Use {key} here anyway")).clicked() {
action = Some((format!("{id}\n{key}"), "replace"));
}
if ui.button("Cancel").clicked() {
if ui.button(app.tr_label("Cancel")).clicked() {
action = Some((String::new(), "cancel"));
}
});
}
ui.label(
RichText::new(
"Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation).",
app.tr_label("Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation)."),
)
.size(11.0)
.color(t.text_dim),
@@ -203,15 +207,16 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
egui::Grid::new("sc_keymap_grid").num_columns(4).striped(true).spacing([10.0, 4.0]).show(ui, |ui| {
for c in command_specs() {
let key = effective(app, c.id).unwrap_or_default();
if !q.is_empty() && ![c.label, c.id, key.as_str()].iter().any(|s| s.to_lowercase().contains(&q)) {
let translated_label = app.tr_label(c.label);
if !q.is_empty() && ![c.label, c.id, key.as_str(), translated_label].iter().any(|s| s.to_lowercase().contains(&q)) {
continue;
}
ui.label(c.label);
ui.label(translated_label);
ui.label(RichText::new(c.id).size(10.5).color(t.text_dim));
let capturing = app.keymap.capturing.as_deref() == Some(c.id);
let changed = app.keymap.custom.contains_key(c.id);
let text = if capturing {
"press a key…".to_string()
app.tr_label("press a key…").to_string()
} else if key.is_empty() {
"—".to_string()
} else {
@@ -223,14 +228,14 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
continue;
}
let b = egui::Button::new(RichText::new(text).color(if changed { t.accent } else { t.text })).min_size(egui::vec2(80.0, 0.0));
if ui.add(b).on_hover_text("Click, then press the new key").clicked() {
if ui.add(b).on_hover_text(app.tr_label("Click, then press the new key")).clicked() {
action = Some((c.id.to_string(), "capture"));
}
ui.horizontal(|ui| {
if ui.add_enabled(!key.is_empty(), egui::Button::new("Clear").small()).clicked() {
if ui.add_enabled(!key.is_empty(), egui::Button::new(app.tr_label("Clear")).small()).clicked() {
action = Some((c.id.to_string(), "clear"));
}
if ui.add_enabled(changed, egui::Button::new("Reset").small()).clicked() {
if ui.add_enabled(changed, egui::Button::new(app.tr_label("Reset")).small()).clicked() {
action = Some((c.id.to_string(), "reset"));
}
});