mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-24 10:09:32 -06:00
i18n: saved workspace names stay verbatim in the workspace menu
Only the built-in workspaces read the Window ▸ Workspace rows; a name the user saved (\"Composition\", say) no longer falls through to the panel catalog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMTAbGNRxnMEzRvYnQGphF
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7d03c0a1f6
commit
60dab98e9b
@@ -639,9 +639,15 @@ fn puppet_options(app: &mut EffectcraftApp, ui: &mut egui::Ui, p: &egui::Painter
|
||||
r.max.x + 16.0
|
||||
}
|
||||
|
||||
/// A workspace's drawn name: built-ins read the menu bar's Window ▸ Workspace row; names the user
|
||||
/// saved stay verbatim, even when one matches a catalog source such as "Composition".
|
||||
fn workspace_label(name: &str) -> &str {
|
||||
if crate::dock::WORKSPACES.contains(&name) { crate::i18n::command_label("window.workspace", name) } else { name }
|
||||
}
|
||||
|
||||
fn ws_menu(app: &mut EffectcraftApp, ui: &mut egui::Ui) {
|
||||
for w in app.workspace_names() {
|
||||
if ui.selectable_label(app.ui.workspace == w, crate::i18n::command_label("window.workspace", &w)).clicked() {
|
||||
if ui.selectable_label(app.ui.workspace == w, workspace_label(&w)).clicked() {
|
||||
app.set_workspace(&w);
|
||||
ui.close();
|
||||
}
|
||||
@@ -692,6 +698,15 @@ mod tests {
|
||||
out.textures_delta.clear();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn saved_workspace_names_stay_verbatim() {
|
||||
crate::i18n::set_current("zh-hans");
|
||||
assert_ne!(workspace_label("Default"), "Default");
|
||||
assert_ne!(crate::i18n::tr("Composition"), "Composition");
|
||||
assert_eq!(workspace_label("Composition"), "Composition");
|
||||
crate::i18n::set_current("en");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn long_press_type_keeps_the_tool_until_vertical_is_selected() {
|
||||
let mut app = EffectcraftApp::new(effectcraft_engine::Session::default());
|
||||
|
||||
Reference in New Issue
Block a user