Skip to content
Open
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
283b3da
i18n(he): add first MaterialCraft Hebrew UI catalog
nocturney Nov 11, 2026
ea3a964
i18n(he): register Hebrew language and assert locale/RTL/catalog keys
nocturney Nov 11, 2026
c193a47
docs(i18n): document partial Hebrew coverage and remaining font QA
nocturney Nov 11, 2026
5bfc0d7
style(i18n): rustfmt Hebrew catalog source
nocturney Nov 11, 2026
071dc5d
i18n(he): align Redo term with shared ArtCraft Hebrew glossary
nocturney Nov 11, 2026
1069514
test(i18n): exercise Hebrew native save/reopen and UI screenshot
nocturney Nov 11, 2026
40ba9a9
feat(i18n): complete Hebrew menu labels for MaterialCraft
Nov 11, 2026
8c30c28
fix(i18n): align native Hebrew menu bar right-to-left
Nov 11, 2026
4a4feaf
fix(i18n): mirror Hebrew inspector headers and parameter controls
Nov 11, 2026
a1a760e
fix(i18n): reserve non-overlapping RTL inspector action columns
Nov 11, 2026
6cfbbf7
i18n(he): translate Native Home and Preferences workflow labels
Nov 11, 2026
49383ef
test(he): isolate native round-trip package from screenshot output
nocturney Nov 11, 2026
cc02abc
test(he): verify round-trip fixture uniqueness and cleanup
nocturney Nov 11, 2026
1428295
style(test): rustfmt isolated Hebrew native smoke fixture
nocturney Nov 11, 2026
615ef16
i18n(he): localize graph inspector attribute and size labels
Nov 11, 2026
b01206d
fix(ui): let RTL inspector literal rows grow to fit editors
Nov 11, 2026
bce6051
test(i18n): isolate Hebrew menu geometry from global locale
Nov 11, 2026
939bc08
fix(i18n): mirror Expose Parameter modal actions in Hebrew
Nov 11, 2026
1befb56
i18n(he): translate Expose Parameter dialog and validation
Nov 11, 2026
0f87ef5
i18n(he): localize visible Native empty-state and library help
Nov 11, 2026
a5e877b
fix(i18n): mirror Hebrew unsaved dialog and isolate mixed-script names
Nov 11, 2026
6c219c8
i18n(he): translate native toolbar and file-export feedback
Nov 11, 2026
96713b8
fix(i18n): avoid duplicate Hebrew warning key and format catalog
Nov 11, 2026
56f8225
i18n(he): localize native library and graph navigation controls
Nov 11, 2026
d5fe61c
feat(i18n): translate Hebrew 3D view and material export controls
Nov 11, 2026
e42c2d4
fix(i18n): mirror 3D view menu bar for Hebrew
Nov 11, 2026
88c89fa
fix(he): align graph node titles to RTL reading edge
Nov 12, 2026
0f1c53c
fix(he): align graph attribute captions to RTL reading edge
Nov 12, 2026
72673b2
feat(he): cover native graph, annotation and file actions
Nov 12, 2026
e48482c
fix(he): mirror material inspector node name editor
Nov 12, 2026
3b6ae57
Localize exposed parameter type labels in Hebrew UI
Nov 12, 2026
eec57e1
fix: mirror parameter color and text rows in Hebrew
Nov 12, 2026
7a7b7fe
fix(ui): mirror graph input and preset rows in Hebrew
Nov 12, 2026
1b65c5f
fix(ui): mirror MaterialCraft export controls in Hebrew
nocturney Nov 13, 2026
b362ce0
style(ui): format Hebrew export and native smoke test
nocturney Nov 13, 2026
7033382
fix(i18n): recognize legacy iw Hebrew locale and RTL in MaterialCraft
nocturney Nov 13, 2026
05835d5
i18n(he): localize Native library preview cache preferences
nocturney Nov 15, 2026
c2ab8df
i18n-he-native-value-input-editor
nocturney Nov 16, 2026
48a169d
i18n(he): translate native inspector node descriptions
nocturney Nov 16, 2026
95e578f
Merge upstream main into MaterialCraft Hebrew PR
Nov 16, 2026
4a9d05e
merge current upstream export and 3D menu with Hebrew RTL support
Nov 19, 2026
178a515
i18n(he): translate live MaterialCraft 3D viewer controls
Nov 19, 2026
f1d2319
fix(i18n): mirror 3D scene browser for RTL locales
Nov 19, 2026
7e6bfe9
i18n(he): translate native export status and 3D viewpoint labels
Nov 19, 2026
a4d85d5
style(he): format source-linked export and viewpoint regression
Nov 19, 2026
afdee61
feat(he): translate native 2D image and histogram controls
Nov 19, 2026
bccbac6
i18n(he): translate native graph and shortcut preferences
Nov 19, 2026
1395828
i18n(he): localize plugin manager and new graph dialogs
Nov 19, 2026
977dec9
i18n(he): translate live 3D render feedback and property controls
Nov 19, 2026
ff10985
i18n(he): translate missing 2D view status and panel controls
nocturney Nov 19, 2026
0179c8f
i18n(he): cover native save feedback home export and suspend labels
nocturney Nov 19, 2026
dcde0d6
style(he): format new native label pairs
nocturney Nov 19, 2026
819c759
feat(i18n): translate remaining native Hebrew Preferences labels
Nov 21, 2026
b0a57c6
fix(a11y): localize native Preferences tab accessibility names
Nov 21, 2026
70084cf
feat(i18n): localize FX-Map node kinds and accessibility names
Nov 21, 2026
36fef34
fix(i18n): localize function instance source in Hebrew inspector
Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions crates/ui-egui/src/export/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ const SIZES: [u32; 7] = [0, 256, 512, 1024, 2048, 4096, 8192];
/// File name patterns the Pattern menu offers
const PATTERNS: [&str; 3] = ["$(graph)_$(identifier)", "$(identifier)", "$(graph)_$(usage)"];

/// Put the leading export control on the right in Hebrew while leaving English LTR.
fn with_export_row<R>(ui: &mut Ui, rtl: bool, add_contents: impl FnOnce(&mut Ui) -> R) -> egui::InnerResponse<R> {
if rtl { ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), add_contents) } else { ui.horizontal(add_contents) }
}

/// What the window's buttons asked for this frame
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Action {
Expand Down Expand Up @@ -89,7 +94,7 @@ pub(crate) fn show(app: &mut MaterialCraftApp, ctx: &egui::Context) {
}

fn tabs(ui: &mut Ui, current: &mut ExportTab) {
ui.horizontal(|ui| {
with_export_row(ui, crate::i18n::is_rtl(), |ui| {
for tab in ExportTab::ALL {
let button = ui.selectable_label(*current == tab, tr(tab.label()));
crate::widgets::name(&button, egui::Role::Tab, tab.label());
Expand All @@ -110,7 +115,7 @@ fn from_graph(app: &mut MaterialCraftApp, ui: &mut Ui, settings: &mut ExportSett
all_or_none(ui, settings, graph.as_slice());

ui.add_space(4.0);
ui.horizontal(|ui| {
with_export_row(ui, crate::i18n::is_rtl(), |ui| {
let automatic = ui.checkbox(&mut settings.automatic, tr("Automatic export when outputs change"));
crate::widgets::name(&automatic, egui::Role::CheckBox, "Automatic export when outputs change");
if settings.automatic {
Expand All @@ -130,7 +135,7 @@ fn batch(app: &mut MaterialCraftApp, ui: &mut Ui, settings: &mut ExportSettings)

ui.add_space(4.0);
let size = &mut settings.batch;
ui.horizontal(|ui| {
with_export_row(ui, crate::i18n::is_rtl(), |ui| {
ui.label(RichText::new(format!("{}:", tr("Output size"))).color(Tokens::get(ui.ctx()).text_dim));
let (mut width, mut height) = (size.width, size.height);
size_menu(ui, "Output width", 110.0, &mut width);
Expand Down Expand Up @@ -194,7 +199,7 @@ fn image_options(app: &mut MaterialCraftApp, ui: &mut Ui, settings: &mut ExportS
ui.end_row();

form_label(ui, tr("Pattern"));
ui.horizontal(|ui| {
with_export_row(ui, crate::i18n::is_rtl(), |ui| {
let field = ui.add(egui::TextEdit::singleline(&mut settings.pattern).desired_width(width - 34.0));
crate::widgets::name(&field, egui::Role::TextInput, "Pattern");
ui.menu_button(icon::CARET_DOWN, |ui| {
Expand Down Expand Up @@ -253,7 +258,7 @@ fn preview_file(settings: &ExportSettings, graph: &Graph) -> Option<String> {
}

fn all_or_none(ui: &mut Ui, settings: &mut ExportSettings, graphs: &[&Graph]) {
ui.horizontal(|ui| {
with_export_row(ui, crate::i18n::is_rtl(), |ui| {
for (label, include) in [("All", true), ("None", false)] {
if ui.add(egui::Button::new(tr(label)).min_size(vec2(100.0, 0.0))).clicked() {
for graph in graphs {
Expand Down Expand Up @@ -282,7 +287,7 @@ fn footer(ui: &mut Ui, tab: ExportTab) -> Option<Action> {
};
let width = (ui.available_width() - 16.0) / 3.0;
let mut action = None;
ui.horizontal(|ui| {
with_export_row(ui, crate::i18n::is_rtl(), |ui| {
if ui.add(crate::widgets::primary_button(ui, tr(export_label)).min_size(vec2(width, 26.0))).clicked() {
action = Some(Action::Export);
}
Expand Down Expand Up @@ -483,3 +488,36 @@ fn material_export_message(report: &Value) -> String {

if unmapped.is_empty() { tr("Material exported").to_string() } else { format!("{}: {}", tr("Exported without shader connections"), unmapped.join(", ")) }
}

#[cfg(test)]
mod export_row_rtl_tests {
use super::with_export_row;

#[test]
fn export_controls_follow_leading_edge_in_hebrew_and_preserve_english_order() {
fn positions(rtl: bool) -> (f32, f32) {
use std::cell::Cell;

let ctx = egui::Context::default();
let leading_x = Cell::new(f32::NAN);
let trailing_x = Cell::new(f32::NAN);
let input = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(700.0, 180.0))), ..Default::default() };
let mut output = ctx.run_ui(input, |ctx| {
egui::CentralPanel::default().show(ctx, |ui| {
with_export_row(ui, rtl, |ui| {
leading_x.set(ui.button("Export").rect.center().x);
trailing_x.set(ui.button("Close").rect.center().x);
});
});
});
output.textures_delta.clear();
(leading_x.get(), trailing_x.get())
}

let (export_en, close_en) = positions(false);
let (export_he, close_he) = positions(true);
assert!(export_en.is_finite() && close_en.is_finite() && export_he.is_finite() && close_he.is_finite());
assert!(export_en < close_en, "English must keep Export before Close from left to right");
assert!(export_he > close_he, "Hebrew must put Export right of Close");
}
}
34 changes: 30 additions & 4 deletions crates/ui-egui/src/graph/node_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,25 @@ pub(crate) fn paint(painter: &Painter, bounds: Rect, zoom: f32, label: &str, col
painter.rect_filled(bounds, radius, CARD_COLOR);
painter.rect_filled(header, CornerRadius { nw: radius, ne: radius, sw: 0, se: 0 }, color);
painter.line_segment([header.left_bottom(), header.right_bottom()], Stroke::new(1.0, Color32::from_black_alpha(110)));

let font = FontId::proportional((11.0 * zoom).clamp(7.0, 16.0));
let title = crate::widgets::elided(painter, label, font.size, Color32::WHITE, header.width() - 10.0 * zoom);
painter.galley(header.left_center() + vec2(5.0 * zoom, -title.size().y * 0.5), title, Color32::WHITE);
let origin = header_label_origin(header, title.size(), crate::i18n::is_rtl());
painter.galley(origin, title, Color32::WHITE);
}

/// Place the graph-node title at the locale reading edge without changing
/// input/output port geometry (which represents wiring direction).
fn header_label_origin(header: Rect, label_size: egui::Vec2, rtl: bool) -> Pos2 {
let x = if rtl { header.right() - 4.0 - label_size.x } else { header.left() + 4.0 };
pos2(x, header.center().y - label_size.y * 0.5)
}

/// The dark well a preview or a value sits in, inside `body`
/// The dark well a preview or a value sits in, inside body
pub(crate) fn paint_well(painter: &Painter, well: Rect, zoom: f32) {
painter.rect_filled(well, (3.0 * zoom).clamp(1.0, 4.0) as u8, WELL_COLOR);
}

/// A short symbol or word centered in `body`, as large as its length allows
/// A short symbol or word centered in body, as large as its length allows
pub(crate) fn paint_symbol(painter: &Painter, body: Rect, zoom: f32, symbol: &str, color: Color32) {
let size = match symbol.chars().count() {
0..=2 => 24.0,
Expand All @@ -87,3 +94,22 @@ pub(crate) fn outline(painter: &Painter, bounds: Rect, zoom: f32, stroke: Stroke
pub(crate) fn paint_dot(painter: &Painter, bounds: Rect, color: Color32) {
painter.circle(bounds.center(), bounds.width() * 0.5, Color32::from_gray(0x50), Stroke::new(1.5, color));
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn node_title_uses_hebrew_reading_edge_without_reversing_port_wiring() {
let node = Rect::from_min_size(pos2(10.0, 20.0), vec2(140.0, 80.0));
let title = header(node, 1.0);
let label = vec2(32.0, 12.0);
let ltr = header_label_origin(title, label, false);
let rtl = header_label_origin(title, label, true);
assert_eq!(ltr.x, 14.0);
assert_eq!(rtl.x, 114.0);
assert_eq!(ltr.y, rtl.y);
assert_eq!(port(node, 0, 1, false, false).x, node.left());
assert_eq!(port(node, 0, 1, true, false).x, node.right());
}
}
161 changes: 156 additions & 5 deletions crates/ui-egui/src/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::sync::OnceLock;
use std::sync::atomic::{AtomicUsize, Ordering};

mod ar;
mod he;

pub struct Language {
/// BCP 47 code ("en", "ar").
Expand All @@ -21,16 +22,26 @@ pub struct Language {
pub table: &'static [(&'static str, &'static str)],
}

const COUNT: usize = 2;
const COUNT: usize = 3;

pub static LANGUAGES: [Language; COUNT] =
[Language { code: "en", name: "English", english: "English", table: &[] }, Language { code: "ar", name: "العربية", english: "Arabic", table: ar::TABLE }];
pub static LANGUAGES: [Language; COUNT] = [
Language { code: "en", name: "English", english: "English", table: &[] },
Language { code: "ar", name: "العربية", english: "Arabic", table: ar::TABLE },
Language { code: "he", name: "עברית", english: "Hebrew", table: he::TABLE },
];

static MAPS: [OnceLock<HashMap<&'static str, &'static str>>; COUNT] = [const { OnceLock::new() }; COUNT];
static CURRENT: AtomicUsize = AtomicUsize::new(0);

// Old Windows and Android locales can still use `iw` for Hebrew.
// Normalize that legacy tag before language selection or direction lookup.
fn canonical_language_code(code: &str) -> &str {
if code.eq_ignore_ascii_case("iw") { "he" } else { code }
}

/// Switch the UI language (unknown codes fall back to English).
pub fn set_language(code: &str) {
let code = canonical_language_code(code);
CURRENT.store(LANGUAGES.iter().position(|l| l.code == code).unwrap_or(0), Ordering::Relaxed);
}

Expand All @@ -41,7 +52,7 @@ pub fn current() -> &'static Language {

/// Returns true if `code` is a right-to-left language (e.g. Arabic `"ar"`).
pub fn is_rtl_code(code: &str) -> bool {
craft_ui::direction::resolve(code, craft_ui::direction::Setting::Language) == craft_ui::direction::Direction::Rtl
craft_ui::direction::resolve(canonical_language_code(code), craft_ui::direction::Setting::Language) == craft_ui::direction::Direction::Rtl
}

/// Returns true if the current UI language is right-to-left.
Expand Down Expand Up @@ -91,7 +102,7 @@ pub fn trf(template: &str, args: &[(&str, &dyn Display)]) -> String {
/// The supported language for a locale such as "ar-EG", "ar-SA" ("en" when none matches).
pub fn language_for_locale(locale: &str) -> &'static str {
let lang = locale.split(['-', '_', '.', '@']).next().unwrap_or("").to_ascii_lowercase();
match lang.as_str() {
match canonical_language_code(lang.as_str()) {
"ar" => "ar",
l => LANGUAGES.iter().find(|x| x.code == l).map_or("en", |x| x.code),
}
Expand All @@ -115,10 +126,150 @@ mod tests {
assert_eq!(language_for_locale("ar"), "ar");
assert_eq!(language_for_locale("ar-EG"), "ar");
assert_eq!(language_for_locale("ar_SA.UTF-8"), "ar");
assert_eq!(language_for_locale("he"), "he");
assert_eq!(language_for_locale("he-IL"), "he");
assert_eq!(language_for_locale("he_IL.UTF-8"), "he");
assert_eq!(language_for_locale("iw"), "he");
assert_eq!(language_for_locale("iw-IL"), "he");
assert_eq!(language_for_locale("iw_IL.UTF-8"), "he");
assert_eq!(canonical_language_code("IW"), "he");
assert!(is_rtl_code("he"));
assert!(is_rtl_code("iw"));
assert_eq!(language_for_locale("en-US"), "en");
assert_eq!(language_for_locale("fr-FR"), "en");
}

#[test]
fn hebrew_table_has_no_duplicate_keys() {
let mut seen = std::collections::HashSet::new();
for (k, _) in he::TABLE {
assert!(seen.insert(*k), "duplicate key in he::TABLE: {k:?}");
}
}

#[test]
fn hebrew_expose_parameter_type_selector_is_localized() {
use materialcraft_engine::core::ValueType;

for value_type in ValueType::ALL {
let source = value_type.label();
let translated = he::TABLE
.iter()
.find(|(key, _)| *key == source)
.map(|(_, value)| *value)
.unwrap_or_else(|| panic!("Missing Hebrew exposed parameter type: {source}"));
assert_ne!(translated, source, "Untranslated exposed parameter type: {source}");
assert!(translated.chars().any(|c| ('\u{0590}'..='\u{05FF}').contains(&c)));
}
}
#[test]
fn hebrew_placeholders_match_source() {
for (k, v) in he::TABLE {
let mut kp: Vec<&str> = k.split('{').skip(1).filter_map(|s| s.split_once('}').map(|(p, _)| p)).collect();
let mut vp: Vec<&str> = v.split('{').skip(1).filter_map(|s| s.split_once('}').map(|(p, _)| p)).collect();
kp.sort();
vp.sort();
assert_eq!(kp, vp, "mismatched placeholders in {k:?} vs {v:?}");
}
}

#[test]
fn hebrew_main_menus_and_file_workflow_are_localized() {
// Prevent untranslated top-level menus and primary file actions
// from slipping back into the Native Hebrew UI.
let essential =
["File", "Edit", "Tools", "Windows", "Help", "Open...", "Save", "Save as...", "Preferences...", "Snap to grid", "Import vector graphics..."];
for source in essential {
let translated = he::TABLE
.iter()
.find(|(key, _)| *key == source)
.map(|(_, translated)| *translated)
.unwrap_or_else(|| panic!("missing Hebrew menu translation: {source}"));
assert_ne!(translated, source, "untranslated Native menu item: {source}");
}
}

#[test]
fn hebrew_home_preferences_and_file_warnings_are_localized() {
// These appear in Native Home, Preferences, graph editing and open/save feedback.
let essential = [
"Function Graph",
"Template",
"Package",
"Undo history (steps)",
"Preview size while editing",
"3D pan limit (mesh radii)",
"3D pan speed",
"Samples",
"Edit function graph...",
"function nodes",
"Bad function",
"Opened with",
"warnings: see the Console",
"Sent to TextureCraft: find it on the shelf under My smart materials",
];
for source in essential {
let translated = he::TABLE
.iter()
.find(|(key, _)| *key == source)
.map(|(_, translated)| *translated)
.unwrap_or_else(|| panic!("missing Hebrew Native Home/Preferences translation: {source}"));
assert_ne!(translated, source, "untranslated Native Home/Preferences label: {source}");
}
}

#[test]
fn hebrew_inspector_graph_attributes_are_localized() {
// All these English source keys already pass through tr() in the Native
// graph inspector; keep both attribute editors and size controls legible.
let inspector = ["Identifier", "Label", "Description", "Category", "Author", "Author URL", "Tags", "Group", "User Data", "Width", "Height"];
for key in inspector {
let translated =
he::TABLE.iter().find(|(source, _)| *source == key).map(|(_, value)| *value).unwrap_or_else(|| panic!("missing Hebrew Inspector label: {key}"));
assert_ne!(translated, key, "untranslated Inspector label: {key}");
assert!(translated.chars().any(|ch| ('א'..='ת').contains(&ch)), "Inspector label lacks Hebrew glyphs: {key}");
}
}

#[test]
fn hebrew_native_toolbar_file_export_and_failure_feedback_are_localized() {
// Actual tr() call-site labels on Native toolbars, file dialogs, and export views.
let essentials = [
"Engine",
"Export outputs... (Ctrl+Shift+E)",
"New graph... (Ctrl+N)",
"Open package... (Ctrl+O)",
"Redo (Ctrl+Y)",
"full size",
"threads",
"Not applied: the active graph or package changed while the file dialog was open",
"The file dialog could not be shown",
"placeholder node(s) stand in for nodes MaterialCraft doesn't have yet (see the warnings above)",
"Couldn't save",
"Download",
"Downloads the SBS and resources together in a ZIP.",
"MaterialCraft Project (*.mcraft)",
"SBS XML Package (*.sbs)",
".mcmat export isn't available yet (#190)",
"Graph's size",
"MaterialX export isn't available yet (#190)",
"files",
"not available yet",
"Exported color space",
"This graph has no outputs",
"Tile 3x3",
];
for key in essentials {
let value = he::TABLE
.iter()
.find(|(source, _)| *source == key)
.map(|(_, v)| *v)
.unwrap_or_else(|| panic!("missing Native Hebrew file/export label: {key}"));
assert_ne!(value, key, "untranslated Native file/export label: {key}");
assert!(value.chars().any(|c| ('א'..='ת').contains(&c)), "no Hebrew letters in {key}");
}
}

#[test]
fn arabic_table_has_no_duplicate_keys() {
let mut seen = std::collections::HashSet::new();
Expand Down
Loading