forked from 1b-agent/opencadstudio-upstream
Complete application localization across all supported languages
This commit is contained in:
1 parent
96c794c072
commit
d66e89ca19
78 files changed
+26043
-877
No files matched your search
@@ -161,7 +161,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
|
||||
crate::tf!("Unknown visual style \"{name}\".").as_ref(),
|
||||
);
|
||||
self.command_line
|
||||
.push_info(visual_style::keyword_prompt());
|
||||
.push_info(crate::t!(visual_style::keyword_prompt()).as_ref());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
|
||||
let path = crate::sys::file_dialog()
|
||||
.set_title(title)
|
||||
.add_filter(filter_name, &exts)
|
||||
.add_filter("All Files", &["*"])
|
||||
.add_filter(crate::t!("All Files").as_ref(), &["*"])
|
||||
.pick_file()
|
||||
.await
|
||||
.map(|h| crate::sys::handle_path(&h));
|
||||
@@ -520,8 +520,8 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
|
||||
BlockPaletteMsg::PickFile => iced::Task::perform(
|
||||
async {
|
||||
let handle = rfd::AsyncFileDialog::new()
|
||||
.set_title("Select Drawing to Insert as Block")
|
||||
.add_filter("DWG/DXF Files", &["dwg", "dxf", "DWG", "DXF"])
|
||||
.set_title(crate::t!("Select Drawing to Insert as Block").as_ref())
|
||||
.add_filter(crate::t!("DWG/DXF Files").as_ref(), &["dwg", "dxf", "DWG", "DXF"])
|
||||
.pick_file()
|
||||
.await;
|
||||
match handle {
|
||||
@@ -535,12 +535,12 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
|
||||
match self.import_file_as_block(path) {
|
||||
Ok(name) => {
|
||||
self.command_line
|
||||
.push_output(&format!("Inserting \"{name}\" from file."));
|
||||
.push_output(&crate::tf!("Inserting \"{name}\" from file."));
|
||||
self.refresh_block_palette();
|
||||
self.start_block_placement(&name);
|
||||
}
|
||||
Err(e) if e != "Cancelled" => {
|
||||
self.command_line.push_error(&format!("INSERT FILE: {e}"));
|
||||
self.command_line.push_error(&crate::tf!("INSERT FILE: {e}"));
|
||||
}
|
||||
Err(_) => {}
|
||||
}
|
||||
|
||||
+23
-23
@@ -2576,7 +2576,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
let pick = Task::perform(
|
||||
async move {
|
||||
let mut dlg = crate::sys::file_dialog()
|
||||
.set_title("Save Drawing As")
|
||||
.set_title(crate::t!("Save Drawing As").as_ref())
|
||||
.set_file_name(default_name)
|
||||
.add_filter(filter_label, &[filter_ext]);
|
||||
if let Some(dir) = seed_dir {
|
||||
@@ -2934,8 +2934,8 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
plot_style.as_ref(),
|
||||
render_options,
|
||||
)
|
||||
.map(|_| format!("Exported: {}", worker_path.display()))
|
||||
.map_err(|e| format!("Export failed: {e}"))
|
||||
.map(|_| crate::tf!("Exported: {}", worker_path.display()).into_owned())
|
||||
.map_err(|e| crate::tf!("Export failed: {e}").into_owned())
|
||||
};
|
||||
self.run_plot_work(self.plot_dialog.background, false, work)
|
||||
}
|
||||
@@ -2978,12 +2978,12 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
plot_style.as_ref(),
|
||||
render_options,
|
||||
)
|
||||
.map(|_| {format!(
|
||||
.map(|_| {crate::tf!(
|
||||
"Plotted window to {}",
|
||||
worker_path
|
||||
.file_name().unwrap_or_default().to_string_lossy()
|
||||
)
|
||||
}).map_err(|e| format!("Plot failed: {e}"))
|
||||
).into_owned()
|
||||
}).map_err(|e| crate::tf!("Plot failed: {e}").into_owned())
|
||||
};
|
||||
self.run_plot_work(self.plot_dialog.background, false, work)
|
||||
}
|
||||
@@ -3071,7 +3071,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
let page_setup = self.tabs[i]
|
||||
.scene
|
||||
.plot_settings_for(&name)
|
||||
.ok_or_else(|| format!("Layout '{name}' has no page setup."))?;
|
||||
.ok_or_else(|| crate::tf!("Layout '{name}' has no page setup.").into_owned())?;
|
||||
{
|
||||
let scene = &mut self.tabs[i].scene;
|
||||
scene.current_layout = name.clone();
|
||||
@@ -3092,10 +3092,10 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
self.tabs[i].scene.restore_saved_camera();
|
||||
}
|
||||
if dialog.style_missing && dialog.apply_plot_styles {
|
||||
return Err(format!(
|
||||
return Err(crate::tf!(
|
||||
"Layout '{name}' plot style table '{}' is not loaded.",
|
||||
dialog.style_name
|
||||
));
|
||||
).into_owned());
|
||||
}
|
||||
let plot_style = self.dialog_plot_style(&dialog);
|
||||
let params = match dialog.area.as_str() {
|
||||
@@ -3135,7 +3135,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
rotation_deg,
|
||||
scale,
|
||||
clip,
|
||||
) = params.ok_or_else(|| format!("Layout '{name}' plot area is empty."))?;
|
||||
) = params.ok_or_else(|| crate::tf!("Layout '{name}' plot area is empty.").into_owned())?;
|
||||
(
|
||||
std::sync::Arc::new(wires),
|
||||
hatches,
|
||||
@@ -3219,8 +3219,8 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
&worker_path,
|
||||
None,
|
||||
)
|
||||
.map(|_| format!("Exported {} layouts to {}", pages.len(), worker_path.display()))
|
||||
.map_err(|error| format!("Export failed: {error}"))
|
||||
.map(|_| crate::tf!("Exported {} layouts to {}", pages.len(), worker_path.display()).into_owned())
|
||||
.map_err(|error| crate::tf!("Export failed: {error}").into_owned())
|
||||
};
|
||||
self.run_print_all_work(dialog.background, work)
|
||||
}
|
||||
@@ -3269,8 +3269,8 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
.and_then(|_| {
|
||||
crate::io::print_to_printer::print_existing_pdf(&temp_path, &options)
|
||||
})
|
||||
.map(|printer| format!("Sent {} layouts to printer: {printer}", pages.len()))
|
||||
.map_err(|error| format!("Print failed: {error}"))
|
||||
.map(|printer| crate::tf!("Sent {} layouts to printer: {printer}", pages.len()).into_owned())
|
||||
.map_err(|error| crate::tf!("Print failed: {error}").into_owned())
|
||||
};
|
||||
self.run_print_all_work(true, work)
|
||||
}
|
||||
@@ -4480,7 +4480,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
plot_style.as_ref(),
|
||||
render_options,
|
||||
).and_then(|_| crate::io::print_to_printer::open_in_viewer(&tmp))
|
||||
.map(|_| "Opened plot preview.".to_string()).map_err(|e| format!("Preview failed: {e}"))
|
||||
.map(|_| crate::t!("Opened plot preview.").into_owned()).map_err(|e| crate::tf!("Preview failed: {e}").into_owned())
|
||||
};
|
||||
return self.run_plot_work(d.background, true, work);
|
||||
}
|
||||
@@ -4497,8 +4497,8 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
plot_style.as_ref(),
|
||||
render_options,
|
||||
).and_then(|_| crate::io::print_to_printer::print_existing_pdf(&tmp, &opts))
|
||||
.map(|printer| format!("Sent to printer: {printer}"))
|
||||
.map_err(|e| format!("Print failed: {e}"))
|
||||
.map(|printer| crate::tf!("Sent to printer: {printer}").into_owned())
|
||||
.map_err(|e| crate::tf!("Print failed: {e}").into_owned())
|
||||
};
|
||||
return self.run_plot_work(true, false, work);
|
||||
}
|
||||
@@ -4525,7 +4525,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
plot_style.as_ref(),
|
||||
render_options,
|
||||
).and_then(|_| crate::io::print_to_printer::open_in_viewer(&tmp))
|
||||
.map(|_| "Opened plot preview.".to_string()).map_err(|e| format!("Preview failed: {e}"))
|
||||
.map(|_| crate::t!("Opened plot preview.").into_owned()).map_err(|e| crate::tf!("Preview failed: {e}").into_owned())
|
||||
};
|
||||
return self.run_plot_work(d.background, true, work);
|
||||
}
|
||||
@@ -4543,8 +4543,8 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
wires, hatches, wipeouts, page_w, page_h, ox, oy, rotation, scale, clip,
|
||||
plot_style, opts,
|
||||
))
|
||||
.map(|printer| format!("Sent to printer: {printer}"))
|
||||
.map_err(|error| format!("Print failed: {error}"))
|
||||
.map(|printer| crate::tf!("Sent to printer: {printer}").into_owned())
|
||||
.map_err(|error| crate::tf!("Print failed: {error}").into_owned())
|
||||
};
|
||||
self.run_plot_work(true, false, work)
|
||||
}
|
||||
@@ -4860,10 +4860,10 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
Task::perform(
|
||||
async move {
|
||||
let dialog = crate::sys::file_dialog()
|
||||
.set_title("Save Plot Style Table")
|
||||
.set_title(crate::t!("Save Plot Style Table").as_ref())
|
||||
.set_file_name(&default_name)
|
||||
.add_filter("Plot Style Files", &["ctb", "CTB"])
|
||||
.add_filter("All Files", &["*"]);
|
||||
.add_filter(crate::t!("Plot Style Files").as_ref(), &["ctb", "CTB"])
|
||||
.add_filter(crate::t!("All Files").as_ref(), &["*"]);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let dialog = match crate::io::plot_style::ensure_plot_styles_dir() {
|
||||
Ok(dir) => dialog.set_directory(dir),
|
||||
|
||||
+38
-38
@@ -907,8 +907,8 @@ impl OpenCADStudio {
|
||||
Message::PdfAttachPick => Task::perform(
|
||||
async {
|
||||
let handle = crate::sys::file_dialog()
|
||||
.set_title("Select PDF Underlay")
|
||||
.add_filter("PDF Files", &["pdf", "PDF"])
|
||||
.set_title(crate::t!("Select PDF Underlay").as_ref())
|
||||
.add_filter(crate::t!("PDF Files").as_ref(), &["pdf", "PDF"])
|
||||
.pick_file()
|
||||
.await;
|
||||
|
||||
@@ -961,11 +961,11 @@ impl OpenCADStudio {
|
||||
Message::XAttachPick => Task::perform(
|
||||
async {
|
||||
let handle = crate::sys::file_dialog()
|
||||
.set_title("Select External Reference File")
|
||||
.add_filter("CAD Files", &["dwg", "dxf", "bak", "DWG", "DXF", "BAK"])
|
||||
.add_filter("DWG Files", &["dwg", "DWG"])
|
||||
.add_filter("DXF Files", &["dxf", "DXF"])
|
||||
.add_filter("Backup Files", &["bak", "BAK"])
|
||||
.set_title(crate::t!("Select External Reference File").as_ref())
|
||||
.add_filter(crate::t!("CAD Files").as_ref(), &["dwg", "dxf", "bak", "DWG", "DXF", "BAK"])
|
||||
.add_filter(crate::t!("DWG Files").as_ref(), &["dwg", "DWG"])
|
||||
.add_filter(crate::t!("DXF Files").as_ref(), &["dxf", "DXF"])
|
||||
.add_filter(crate::t!("Backup Files").as_ref(), &["bak", "BAK"])
|
||||
.pick_file()
|
||||
.await;
|
||||
match handle {
|
||||
@@ -999,9 +999,9 @@ impl OpenCADStudio {
|
||||
Task::perform(
|
||||
async move {
|
||||
let path = crate::sys::file_dialog()
|
||||
.set_title("Save Block As")
|
||||
.set_title(crate::t!("Save Block As").as_ref())
|
||||
.set_file_name("block.dwg")
|
||||
.add_filter("DWG Files", &["dwg"])
|
||||
.add_filter(crate::t!("DWG Files").as_ref(), &["dwg"])
|
||||
.save_file()
|
||||
.await
|
||||
.map(|h| crate::sys::handle_path(&h));
|
||||
@@ -1035,10 +1035,10 @@ impl OpenCADStudio {
|
||||
Task::perform(
|
||||
async move {
|
||||
let path = crate::sys::file_dialog()
|
||||
.set_title("Save Data Extraction")
|
||||
.set_title(crate::t!("Save Data Extraction").as_ref())
|
||||
.set_file_name("extraction.csv")
|
||||
.add_filter("CSV", &["csv"])
|
||||
.add_filter("All Files", &["*"])
|
||||
.add_filter(crate::t!("CSV").as_ref(), &["csv"])
|
||||
.add_filter(crate::t!("All Files").as_ref(), &["*"])
|
||||
.save_file()
|
||||
.await
|
||||
.map(|h| crate::sys::handle_path(&h));
|
||||
@@ -1078,10 +1078,10 @@ impl OpenCADStudio {
|
||||
Task::perform(
|
||||
async {
|
||||
crate::sys::file_dialog()
|
||||
.set_title("Export STL")
|
||||
.set_title(crate::t!("Export STL").as_ref())
|
||||
.set_file_name("export.stl")
|
||||
.add_filter("STL Files", &["stl"])
|
||||
.add_filter("All Files", &["*"])
|
||||
.add_filter(crate::t!("STL Files").as_ref(), &["stl"])
|
||||
.add_filter(crate::t!("All Files").as_ref(), &["*"])
|
||||
.save_file()
|
||||
.await
|
||||
.map(|h| crate::sys::handle_path(&h))
|
||||
@@ -1115,10 +1115,10 @@ impl OpenCADStudio {
|
||||
Task::perform(
|
||||
async {
|
||||
crate::sys::file_dialog()
|
||||
.set_title("Export STEP AP203")
|
||||
.set_title(crate::t!("Export STEP AP203").as_ref())
|
||||
.set_file_name("export.step")
|
||||
.add_filter("STEP Files", &["step", "stp"])
|
||||
.add_filter("All Files", &["*"])
|
||||
.add_filter(crate::t!("STEP Files").as_ref(), &["step", "stp"])
|
||||
.add_filter(crate::t!("All Files").as_ref(), &["*"])
|
||||
.save_file()
|
||||
.await
|
||||
.map(|h| crate::sys::handle_path(&h))
|
||||
@@ -1145,9 +1145,9 @@ impl OpenCADStudio {
|
||||
Message::ObjImport => Task::perform(
|
||||
async {
|
||||
crate::sys::file_dialog()
|
||||
.set_title("Import OBJ Mesh")
|
||||
.add_filter("Wavefront OBJ", &["obj", "OBJ"])
|
||||
.add_filter("All Files", &["*"])
|
||||
.set_title(crate::t!("Import OBJ Mesh").as_ref())
|
||||
.add_filter(crate::t!("Wavefront OBJ").as_ref(), &["obj", "OBJ"])
|
||||
.add_filter(crate::t!("All Files").as_ref(), &["*"])
|
||||
.pick_file()
|
||||
.await
|
||||
.map(|h| crate::sys::handle_path(&h))
|
||||
@@ -1286,11 +1286,11 @@ impl OpenCADStudio {
|
||||
.scene
|
||||
.set_projection_preserving_frame(proj);
|
||||
self.ribbon.set_ortho(ortho);
|
||||
self.command_line.push_output(if ortho {
|
||||
self.command_line.push_output(crate::t!(if ortho {
|
||||
"Projection: Orthographic"
|
||||
} else {
|
||||
"Projection: Perspective"
|
||||
});
|
||||
}).as_ref());
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -6613,13 +6613,13 @@ impl OpenCADStudio {
|
||||
crate::plugin::external::normalize_repository(&self.plugin_repo_input)
|
||||
else {
|
||||
self.marketplace_status =
|
||||
"Enter a GitHub URL or repository in owner/repo format.".to_string();
|
||||
crate::t!("Enter a GitHub URL or repository in owner/repo format.").into_owned();
|
||||
return Task::none();
|
||||
};
|
||||
if self.plugin_repos.contains(&repo)
|
||||
|| self.plugin_registry.iter().any(|entry| entry.repo == repo)
|
||||
{
|
||||
self.marketplace_status = format!("{repo} is already in the catalog.");
|
||||
self.marketplace_status = crate::tf!("{repo} is already in the catalog.").into_owned();
|
||||
self.selected_plugin_repo = Some(repo.clone());
|
||||
if !self.plugin_readmes.contains_key(&repo)
|
||||
&& self.plugin_readme_loading.insert(repo.clone())
|
||||
@@ -6633,7 +6633,7 @@ impl OpenCADStudio {
|
||||
.iter()
|
||||
.any(|plugin| plugin.repository.as_deref() == Some(repo.as_str()))
|
||||
{
|
||||
self.marketplace_status = format!("{repo} is already installed.");
|
||||
self.marketplace_status = crate::tf!("{repo} is already installed.").into_owned();
|
||||
self.selected_plugin_repo = Some(repo.clone());
|
||||
if !self.plugin_readmes.contains_key(&repo)
|
||||
&& self.plugin_readme_loading.insert(repo.clone())
|
||||
@@ -6645,7 +6645,7 @@ impl OpenCADStudio {
|
||||
self.plugin_repos.push(repo.clone());
|
||||
self.plugin_repo_input.clear();
|
||||
self.persist_settings_if_changed();
|
||||
self.marketplace_status = format!("Fetching releases for {repo}…");
|
||||
self.marketplace_status = crate::tf!("Fetching releases for {repo}…").into_owned();
|
||||
self.selected_plugin_repo = Some(repo.clone());
|
||||
self.plugin_readmes.remove(&repo);
|
||||
self.plugin_readme_loading.insert(repo.clone());
|
||||
@@ -6791,12 +6791,12 @@ impl OpenCADStudio {
|
||||
.entry(repo.clone())
|
||||
.or_insert_with(|| first.tag.clone());
|
||||
}
|
||||
if self.marketplace_status == format!("Fetching releases for {repo}…") {
|
||||
if self.marketplace_status == crate::tf!("Fetching releases for {repo}…").into_owned() {
|
||||
self.marketplace_status =
|
||||
format!(
|
||||
crate::tf!(
|
||||
"Repository added. {} installable release(s) found.",
|
||||
releases.len()
|
||||
);
|
||||
).into_owned();
|
||||
}
|
||||
self.repo_release_tags.insert(repo, releases);
|
||||
Task::none()
|
||||
@@ -6834,15 +6834,15 @@ impl OpenCADStudio {
|
||||
let Some(tag) = self.repo_selected_tag.get(&repo).cloned() else {
|
||||
return Task::none();
|
||||
};
|
||||
self.marketplace_status = format!("Installing {repo} {tag}…");
|
||||
self.marketplace_status = crate::tf!("Installing {repo} {tag}…").into_owned();
|
||||
self.install_task(repo, tag)
|
||||
}
|
||||
Message::PluginUpdate(repo, tag) => {
|
||||
self.marketplace_status = format!("Updating {repo} to {tag}…");
|
||||
self.marketplace_status = crate::tf!("Updating {repo} to {tag}…").into_owned();
|
||||
self.install_task(repo, tag)
|
||||
}
|
||||
Message::PluginInstalled(Ok(id)) => {
|
||||
self.marketplace_status = format!("Installed '{id}'. Restart to load it.");
|
||||
self.marketplace_status = crate::tf!("Installed '{id}'. Restart to load it.").into_owned();
|
||||
self.plugin_load_errors.remove(&id);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
@@ -6851,7 +6851,7 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
Message::PluginInstalled(Err(e)) => {
|
||||
self.marketplace_status = format!("Install failed: {e}");
|
||||
self.marketplace_status = crate::tf!("Install failed: {e}").into_owned();
|
||||
Task::none()
|
||||
}
|
||||
Message::PluginUninstall(id) => {
|
||||
@@ -6861,20 +6861,20 @@ impl OpenCADStudio {
|
||||
// and allows the package directory to be deleted.
|
||||
if !crate::plugin::external::remove_plugin(&id) {
|
||||
self.marketplace_status =
|
||||
format!("Uninstall failed: plugin '{id}' did not stop in time");
|
||||
crate::tf!("Uninstall failed: plugin '{id}' did not stop in time").into_owned();
|
||||
return Task::none();
|
||||
}
|
||||
match crate::plugin::external::uninstall(&id) {
|
||||
Ok(()) => {
|
||||
self.marketplace_status =
|
||||
format!("Uninstalled '{id}'.");
|
||||
crate::tf!("Uninstalled '{id}'.").into_owned();
|
||||
self.plugin_load_errors.remove(&id);
|
||||
self.loaded_plugin_ids.remove(&id);
|
||||
self.rebuild_ribbon_modules();
|
||||
self.external_plugins = crate::plugin::external::discover();
|
||||
}
|
||||
Err(e) => {
|
||||
self.marketplace_status = format!("Uninstall failed: {e}");
|
||||
self.marketplace_status = crate::tf!("Uninstall failed: {e}").into_owned();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7344,7 +7344,7 @@ impl OpenCADStudio {
|
||||
Message::PlotStyleLoaded(Some(table)) => {
|
||||
if table.is_stb {
|
||||
self.command_line.push_error(
|
||||
"Named plot style tables are not supported by the vector plotter.",
|
||||
crate::t!("Named plot style tables are not supported by the vector plotter.").as_ref(),
|
||||
);
|
||||
return Task::none();
|
||||
}
|
||||
|
||||
@@ -5122,7 +5122,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
self.tabs[i].scene.camera_generation += 1;
|
||||
self.command_line
|
||||
.push_output(crate::tf!("View: {}", region.label()).as_ref());
|
||||
.push_output(crate::tf!("View: {}", crate::t!(region.label())).as_ref());
|
||||
Task::none()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user