Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

i18n (cs): translate remaining dialog, panel, menu and About strings

Losminek59f358f709db
diff --git a/crates/ui-egui/src/about.rs b/crates/ui-egui/src/about.rs
index 4eae2e7c6..238d6270c 100644
--- a/crates/ui-egui/src/about.rs
+++ b/crates/ui-egui/src/about.rs
@@ -122,9 +122,9 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
ui.allocate_ui_with_layout(vec2(ui.available_width(), h), egui::Layout::top_down(egui::Align::Min), |ui| {
ui.set_min_height(h);
if app.ui.about_tab == 1 {
- crate::credits::contributors_ui(ui);
+ crate::credits::contributors_ui(ui, &app.ui.language);
} else {
- crate::credits::models_ui(ui);
+ crate::credits::models_ui(ui, &app.ui.language);
}
});
ui.separator();
@@ -164,7 +164,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
.color(t.text_dim),
));
ui.add_space(16.0);
- if discord_button(ui, "Join the ArtCraft Discord", vec2(300.0, 40.0)) {
+ if discord_button(ui, crate::i18n::tr(&app.ui.language, "Join the ArtCraft Discord"), vec2(300.0, 40.0)) {
open = Some("discord");
}
ui.add_space(4.0);
@@ -182,7 +182,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
for (text, key) in
[("DesignCraft page", "appPage"), ("GitHub", "github"), ("getartcraft.com", "website"), ("Report an issue", "issues")]
{
- if link(ui, text, links::get(key).unwrap_or_default(), t.accent) {
+ if link(ui, crate::i18n::tr(&app.ui.language, text), links::get(key).unwrap_or_default(), t.accent) {
open = Some(key);
}
ui.add_space(6.0);
@@ -206,8 +206,9 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
ui.add_space(((ui.available_width() - w) / 2.0).max(0.0));
for (slug, name, what) in SIBLINGS {
let url = format!("{}/apps/{slug}", links::WEBSITE);
- let b =
- ui.add(egui::Button::new(egui::RichText::new(*name).size(12.0)).corner_radius(10.0)).on_hover_text(format!("{what} — {url}"));
+ let b = ui
+ .add(egui::Button::new(egui::RichText::new(*name).size(12.0)).corner_radius(10.0))
+ .on_hover_text(format!("{} — {url}", crate::i18n::tr(&app.ui.language, what)));
if b.clicked() {
app.ui.pending_urls.push(url);
}
diff --git a/crates/ui-egui/src/credits.rs b/crates/ui-egui/src/credits.rs
index 765dec19d..b9efa035a 100644
--- a/crates/ui-egui/src/credits.rs
+++ b/crates/ui-egui/src/credits.rs
@@ -7,6 +7,8 @@ use std::cmp::Ordering;
use egui::RichText;
+use crate::i18n::{tr, tr_context};
+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Contributor {
pub login: &'static str,
@@ -211,45 +213,48 @@ impl Default for View {
}
/// About ▸ Contributors: a name toggle, a sort, and the list as a grab bag or a table.
-pub fn contributors_ui(ui: &mut egui::Ui) {
+pub fn contributors_ui(ui: &mut egui::Ui, lang: &str) {
let id = egui::Id::new("credits_view");
let mut v = ui.data_mut(|d| d.get_temp::<View>(id)).unwrap_or_default();
ui.horizontal_wrapped(|ui| {
- ui.label("Show");
+ ui.label(tr(lang, "Show"));
for m in NameMode::ALL {
- if ui.selectable_label(v.names == m, m.label()).clicked() {
+ if ui.selectable_label(v.names == m, tr(lang, m.label())).clicked() {
v.names = m;
}
}
ui.separator();
- ui.label("Sort");
- egui::ComboBox::from_id_salt("credits_sort").selected_text(v.key.label().0).show_ui(ui, |ui| {
+ ui.label(tr(lang, "Sort"));
+ egui::ComboBox::from_id_salt("credits_sort").selected_text(tr(lang, v.key.label().0)).show_ui(ui, |ui| {
for k in SortKey::ALL {
- if ui.selectable_label(v.key == k, k.label().0).clicked() {
+ if ui.selectable_label(v.key == k, tr(lang, k.label().0)).clicked() {
v.key = k;
v.ascending = k.default_ascending();
}
}
});
- if ui.button(if v.ascending { "▲" } else { "▼" }).on_hover_text("Reverse the order").clicked() {
+ if ui.button(if v.ascending { "▲" } else { "▼" }).on_hover_text(tr(lang, "Reverse the order")).clicked() {
v.ascending = !v.ascending;
}
ui.separator();
- if ui.selectable_label(!v.table, "Grab bag").clicked() {
+ if ui.selectable_label(!v.table, tr(lang, "Grab bag")).clicked() {
v.table = false;
}
- if ui.selectable_label(v.table, "Table").clicked() {
+ if ui.selectable_label(v.table, tr(lang, "Table")).clicked() {
v.table = true;
}
});
let list = sorted(CONTRIBUTORS, v.names, v.key, v.ascending);
- ui.label(RichText::new(format!("{} contributors · {} commits", list.len(), group(TOTAL_COMMITS))).small().weak());
+ let totals = tr(lang, "{contributors} contributors · {commits} commits")
+ .replace("{contributors}", &list.len().to_string())
+ .replace("{commits}", &group(TOTAL_COMMITS));
+ ui.label(RichText::new(totals).small().weak());
ui.separator();
egui::ScrollArea::both().auto_shrink([false, false]).show(ui, |ui| {
if list.is_empty() {
- ui.label("No contributor data was built into this copy.");
+ ui.label(tr(lang, "No contributor data was built into this copy."));
} else if v.table {
- table(ui, &list, &mut v);
+ table(ui, &list, &mut v, lang);
} else {
ui.horizontal_wrapped(|ui| {
for (i, c) in list.iter().enumerate() {
@@ -264,11 +269,12 @@ pub fn contributors_ui(ui: &mut egui::Ui) {
ui.data_mut(|d| d.insert_temp(id, v));
}
-fn table(ui: &mut egui::Ui, list: &[&Contributor], v: &mut View) {
+fn table(ui: &mut egui::Ui, list: &[&Contributor], v: &mut View, lang: &str) {
egui::Grid::new("credits_table").striped(true).num_columns(SortKey::ALL.len()).show(ui, |ui| {
for k in SortKey::ALL {
let arrow = if v.key == k { if v.ascending { " ▲" } else { " ▼" } } else { "" };
- if ui.button(RichText::new(format!("{}{arrow}", k.label().1)).strong()).on_hover_text(k.label().0).clicked() {
+ let header = format!("{}{arrow}", tr_context(lang, k.label().1, "contributors"));
+ if ui.button(RichText::new(header).strong()).on_hover_text(tr(lang, k.label().0)).clicked() {
if v.key == k {
v.ascending = !v.ascending;
} else {
@@ -295,16 +301,16 @@ fn table(ui: &mut egui::Ui, list: &[&Contributor], v: &mut View) {
}
/// About ▸ Models: AI models credited in Co-Authored-By trailers.
-pub fn models_ui(ui: &mut egui::Ui) {
+pub fn models_ui(ui: &mut egui::Ui, lang: &str) {
if MODELS.is_empty() {
- ui.label("No model credits were built into this copy.");
+ ui.label(tr(lang, "No model credits were built into this copy."));
return;
}
let assisted: u64 = MODELS.iter().map(|m| m.commits).max().unwrap_or(0).max(1);
egui::ScrollArea::both().auto_shrink([false, false]).show(ui, |ui| {
egui::Grid::new("credits_models").striped(true).num_columns(6).show(ui, |ui| {
for h in ["Company", "Model", "Version", "Commits", "% of all commits", "Lines +/−"] {
- ui.label(RichText::new(h).strong());
+ ui.label(RichText::new(tr(lang, h)).strong());
}
ui.end_row();
for m in MODELS {
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index 371b5b6ac..b3ef8e0d4 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -216,7 +216,7 @@ fn keyboard_shortcuts(app: &mut DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {
crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, label.trim_end_matches('…')))
.on_hover_text(format!("{id}{}", if menu.is_empty() { String::new() } else { format!(" ({menu})") }));
let cur = crate::menus::shortcut_of(app, id).map(|s| crate::menus::shortcut_text(&s)).unwrap_or_else(|| "—".into());
- let text = if recording == *id { "Press keys…".to_string() } else { cur };
+ let text = if recording == *id { crate::i18n::tr(&app.ui.language, "Press keys…").to_string() } else { cur };
if ui.add(egui::Button::new(text).min_size(egui::vec2(110.0, 0.0))).clicked() {
d.fields.insert("recording".into(), json!(id));
d.fields.insert("message".into(), json!(""));
@@ -295,11 +295,11 @@ fn print_dialog(app: &crate::DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {
crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Pages:"));
ui.vertical(|ui| {
let range = d.s("range");
- if ui.radio(range == "all", "All").clicked() {
+ if ui.radio(range == "all", crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, "All"))).clicked() {
d.fields.insert("range".into(), json!("all"));
}
ui.horizontal(|ui| {
- if ui.radio(range == "range", "Range:").clicked() {
+ if ui.radio(range == "range", crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, "Range:"))).clicked() {
d.fields.insert("range".into(), json!("range"));
}
text_field(ui, d, "pages", 120.0);
@@ -1018,12 +1018,12 @@ fn preferences(app: &crate::DesignApp, ui: &mut egui::Ui, d: &mut Dialog, max_he
ui.end_row();
});
ui.add_space(6.0);
- check(ui, d, "snap.alignEdges", "Align to Object Edges");
- check(ui, d, "snap.alignCenters", "Align to Object Centers");
- check(ui, d, "snap.dimensions", "Smart Dimensions");
- check(ui, d, "snap.spacing", "Smart Spacing");
+ check(ui, d, "snap.alignEdges", crate::i18n::tr(&app.ui.language, "Align to Object Edges"));
+ check(ui, d, "snap.alignCenters", crate::i18n::tr(&app.ui.language, "Align to Object Centers"));
+ check(ui, d, "snap.dimensions", crate::i18n::tr(&app.ui.language, "Smart Dimensions"));
+ check(ui, d, "snap.spacing", crate::i18n::tr(&app.ui.language, "Smart Spacing"));
ui.horizontal(|ui| {
- ui.label("Snap to Zone");
+ crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Snap to Zone"));
let mut zone = d.n("snap.zone").filter(|z| z.is_finite()).unwrap_or(4.0);
if ui.add(egui::DragValue::new(&mut zone).speed(0.1)).changed() {
d.fields.insert("snap.zone".into(), json!(zone));
@@ -1288,7 +1288,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
for (key, label, any) in [("objFill", "Find fill:", "(any)"), ("objChangeFill", "Change fill to:", "(unchanged)")] {
crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, label));
let cur = d.s(key);
- egui::ComboBox::from_id_salt(key).selected_text(if cur.is_empty() { any } else { cur.as_str() }).width(180.0).show_ui(ui, |ui| {
+ egui::ComboBox::from_id_salt(key).selected_text(if cur.is_empty() { crate::i18n::tr(&app.ui.language, any) } else { cur.as_str() }).width(180.0).show_ui(ui, |ui| {
if ui.selectable_label(cur.is_empty(), crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, any))).clicked() {
d.fields.insert(key.into(), json!(""));
}
@@ -1302,7 +1302,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
}
crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Kind:"));
let cur = d.s("objKind");
- egui::ComboBox::from_id_salt("objKind").selected_text(if cur.is_empty() { "(any)" } else { cur.as_str() }).show_ui(ui, |ui| {
+ egui::ComboBox::from_id_salt("objKind").selected_text(if cur.is_empty() { crate::i18n::tr(&app.ui.language, "(any)") } else { cur.as_str() }).show_ui(ui, |ui| {
for v in ["", "text", "graphic", "shape", "line", "group"] {
if ui.selectable_label(cur == v, crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, if v.is_empty() { "(any)" } else { v }))).clicked() {
d.fields.insert("objKind".into(), json!(v));
@@ -1360,22 +1360,22 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
if ui.button(crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, "Find Next"))).clicked() {
let r = app.run("find.next", params());
let msg = match r {
- Ok(Value::Null) => "No matches".to_string(),
- Ok(_) => "Found".to_string(),
+ Ok(Value::Null) => crate::i18n::tr(&app.ui.language, "No matches").to_string(),
+ Ok(_) => crate::i18n::tr(&app.ui.language, "Found").to_string(),
Err(e) => e,
};
d.fields.insert("status".into(), json!(msg));
}
if ui.button(crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, "Change All"))).clicked() {
let msg = match app.run("find.change", params()) {
- Ok(v) => format!("{} replacement(s) made", v["count"]),
+ Ok(v) => crate::i18n::tr(&app.ui.language, "{count} replacement(s) made").replace("{count}", &v["count"].to_string()),
Err(e) => e,
};
d.fields.insert("status".into(), json!(msg));
}
if ui.button(crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, "Count"))).clicked() {
let msg = match app.run("find.find", params()) {
- Ok(v) => format!("{} match(es)", v.as_array().map(|a| a.len()).unwrap_or(0)),
+ Ok(v) => crate::i18n::tr(&app.ui.language, "{count} match(es)").replace("{count}", &v.as_array().map_or(0, |a| a.len()).to_string()),
Err(e) => e,
};
d.fields.insert("status".into(), json!(msg));
@@ -1499,11 +1499,11 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
if !d.b("removeStyles") {
crate::rtl::label(ui, egui::RichText::new(crate::i18n::tr(&app.ui.language, "Style Name Conflicts")).font(semibold(12.0)));
let conflicts: Vec<String> = d.fields.get("conflicts").and_then(Value::as_array).map(|a| a.iter().filter_map(|v| v.as_str().map(str::to_string)).collect()).unwrap_or_default();
- ui.label(if conflicts.is_empty() { crate::i18n::tr(&app.ui.language, "No conflicts").to_string() } else { format!("{} conflict(s): {}", conflicts.len(), conflicts.join(", ")) });
+ ui.label(if conflicts.is_empty() { crate::i18n::tr(&app.ui.language, "No conflicts").to_string() } else { crate::i18n::tr(&app.ui.language, "{count} conflict(s): {names}").replace("{count}", &conflicts.len().to_string()).replace("{names}", &conflicts.join(", ")) });
let cur = d.s("styleConflicts");
ui.horizontal(|ui| {
for (v, l) in [("useExisting", "Use Document Style Definition"), ("redefine", "Redefine Document Style"), ("autoRename", "Auto Rename")] {
- if ui.radio(cur == v, l).clicked() {
+ if ui.radio(cur == v, crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, l))).clicked() {
d.fields.insert("styleConflicts".into(), json!(v));
}
}
@@ -3564,7 +3564,7 @@ fn insert_xref(app: &mut DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {
let all = "[All Paragraphs]";
ui.horizontal(|ui| {
crate::rtl::label(ui, crate::i18n::tr(&app.ui.language, "Link To:"));
- combo(ui, d, "linkTo", &[("paragraph", "Paragraph"), ("anchor", "Text Anchor")]);
+ translated_combo(&app.ui.language, ui, d, "linkTo", &[("paragraph", "Paragraph"), ("anchor", "Text Anchor")]);
});
ui.add_space(6.0);
let dim = crate::theme::Tokens::get(ui.ctx()).text_dim;
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index e9809e9ee..0f27e2b11 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -3063,6 +3063,11 @@ mod tests {
keys.extend(crate::menus::UI_COMMANDS.iter().map(|(_, label, _, _)| *label));
// Tool names reach `tr` from the Tools panel.
keys.extend(designcraft_tools::TOOL_GROUPS.iter().flat_map(|group| group.iter()).map(|tool| tool.label));
+ // So do the About window's tab names, app descriptions and the credits' column and sort labels.
+ keys.extend(crate::about::ABOUT_TABS);
+ keys.extend(crate::about::SIBLINGS.iter().map(|(_, _, what)| *what));
+ keys.extend(crate::credits::NameMode::ALL.iter().map(|mode| mode.label()));
+ keys.extend(crate::credits::SortKey::ALL.iter().flat_map(|key| [key.label().0, key.label().1]));
// UI labels passed to `tr` that no other catalog has yet.
keys.extend([
"(any)",
@@ -3088,6 +3093,41 @@ mod tests {
"Text:",
"Unsaved Changes",
"“{}” has changes that are not saved. Save them before closing?",
+ "% of all commits",
+ "{count} conflict(s): {names}",
+ "{count} match(es)",
+ "{count} replacement(s) made",
+ "{contributors} contributors · {commits} commits",
+ "{label}: {name} (double-click: Color Picker)",
+ "All",
+ "Align To",
+ "Auto Rename",
+ "Character Style",
+ "Company",
+ "DesignCraft page",
+ "Equal fixed heights for the selected rows; cell text may become overset.",
+ "Found",
+ "Grab bag",
+ "Key Object",
+ "layer",
+ "layers",
+ "Lines +/−",
+ "New Cell Style",
+ "New Table Style",
+ "No contributor data was built into this copy.",
+ "No matches",
+ "No model credits were built into this copy.",
+ "Object Style",
+ "Paragraph Style",
+ "Press keys…",
+ "Range:",
+ "Redefine Document Style",
+ "Report an issue",
+ "Reverse the order",
+ "Story {story} ← story {parent}",
+ "Story Editor — {count} words",
+ "Text Anchor",
+ "Use Document Style Definition",
// Status-bar messages.
"Alternate layout",
"Couldn't write recovery data: {error}",
@@ -3130,6 +3170,8 @@ mod tests {
assert_eq!(tr("cs", "Edit/Interface Language"), "Úpravy/Jazyk rozhraní");
assert_eq!(tr("cs", "Unknown label"), "Unknown label");
assert_eq!(tr_context("cs", "Group", "selection"), "Skupina");
+ assert_eq!(tr_context("cs", "Name", "contributors"), "Jméno");
+ assert_eq!(tr_context("cs", "Name", "unknown"), "Název");
assert_eq!(tr("cs", "Group"), "Seskupit");
assert_eq!(tr_context("cs", "Columns", "table"), tr("cs", "Columns"));
assert_eq!(style_name("cs", "[Basic Paragraph]"), "[Základní odstavec]");
@@ -3152,6 +3194,9 @@ mod tests {
assert_eq!(count_label("cs", "items", 1), "1 položka");
assert_eq!(count_label("cs", "objects", 7), "7 objektů");
assert_eq!(count_label("cs", "warnings", 3), "3 varování");
+ assert_eq!(count_label("cs", "layer", 1), "1 vrstva");
+ assert_eq!(count_label("cs", "layers", 3), "3 vrstvy");
+ assert_eq!(count_label("cs", "layers", 8), "8 vrstev");
// A noun without plural forms keeps the plain translation.
assert_eq!(count_label("cs", "a new noun", 3), "3 a new noun");
for (noun, forms) in cs::PLURALS {
diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rs
index 7726b99df..ade5a1d25 100644
--- a/crates/ui-egui/src/i18n/cs.rs
+++ b/crates/ui-egui/src/i18n/cs.rs
@@ -1725,24 +1725,36 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Working CMYK", "Pracovní CMYK"),
("Yellow", "Žlutá"),
// Labels the code passes to `tr` that no other catalog has yet.
+ ("About", "O aplikaci"),
("Activate Panel", "Aktivovat panel"),
("Add Anchor Point Tool", "Nástroj Přidat kotevní bod"),
+ ("Align To", "Zarovnat k"),
+ ("All", "Vše"),
("Alternate layout", "Alternativní rozvržení"),
+ ("Auto Rename", "Přejmenovat automaticky"),
+ ("Binary assets added", "Přidané binární soubory"),
+ ("Binary assets removed", "Odebrané binární soubory"),
("Cell Number:", "Číslo mobilu:"),
("Change fill to:", "Změnit výplň na:"),
("Change Panel Layout", "Změnit rozvržení panelů"),
+ ("Character Style", "Styl znaku"),
("Chinese: Simplified", "Čínština: zjednodušená"),
("Chinese: Traditional", "Čínština: tradiční"),
("Close Panel", "Zavřít panel"),
("Color Theme Tool", "Nástroj Motiv barev"),
+ ("Commits", "Commity"),
+ ("Company", "Společnost"),
("Content Collector Tool", "Nástroj Sběrač obsahu"),
("Content Placer Tool", "Nástroj Umísťovač obsahu"),
+ ("Contributors", "Přispěvatelé"),
("Convert Direction Point Tool", "Nástroj Převést směrový bod"),
("Couldn't write recovery data: {error}", "Nelze zapsat data pro obnovu: {error}"),
("Data Fields", "Datová pole"),
("Data Merge Options", "Možnosti sloučení dat"),
("Delete Anchor Point Tool", "Nástroj Odstranit kotevní bod"),
+ ("DesignCraft page", "Stránka DesignCraftu"),
("Direct Selection Tool", "Nástroj Přímý výběr"),
+ ("Display name", "Zobrazované jméno"),
("Distribute Rows Evenly", "Rozmístit řádky rovnoměrně"),
("Don't Save", "Neukládat"),
("Drag Rows or Columns", "Přetáhnout řádky nebo sloupce"),
@@ -1750,6 +1762,7 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Ellipse Tool", "Nástroj Elipsa"),
("Email Address:", "E-mailová adresa:"),
("Email:", "E-mail:"),
+ ("Equal fixed heights for the selected rows; cell text may become overset.", "Stejné pevné výšky vybraných řádků; text buněk může přesáhnout."),
("Erase Tool", "Nástroj Guma"),
(
"Export a PDF, IDML or package to share — no cloud account needed.",
@@ -1757,42 +1770,73 @@ pub(super) const TABLE: &[(&str, &str)] = &[
),
("Eyedropper Tool", "Nástroj Kapátko"),
("Find fill:", "Najít výplň:"),
+ ("First commit", "První commit"),
+ ("Found", "Nalezeno"),
("Free Transform Tool", "Nástroj Volná transformace"),
("Gap Tool", "Nástroj Mezera"),
+ ("Grab bag", "Seznam"),
("Gradient Feather Tool", "Nástroj Přechodové zjemnění okraje"),
("Gradient Swatch Tool", "Nástroj Vzorek přechodu"),
("Group with", "Seskupit s"),
("H:", "V:"),
("Hand Tool", "Nástroj Ruka"),
+ ("image editing", "úpravy obrázků"),
("Import cancelled: the originating document has closed", "Import zrušen: původní dokument byl zavřen"),
("Insert Field", "Vložit pole"),
("Invalid panel layout; restored the default dock", "Neplatné rozvržení panelů; obnoveno výchozí ukotvení"),
+ ("Key Object", "Klíčový objekt"),
+ ("Last commit", "Poslední commit"),
+ ("layer", "vrstva"),
+ ("layers", "vrstev"),
+ ("Line delta", "Rozdíl řádků"),
("Line Tool", "Nástroj Čára"),
+ ("Lines +/−", "Řádky +/−"),
+ ("Lines added", "Přidané řádky"),
+ ("Lines deleted", "Odstraněné řádky"),
("List Composite Fonts", "Vypsat složená písma"),
("Measure Tool", "Nástroj Měřidlo"),
+ ("Merged PRs", "Sloučené PR"),
("Message:", "Zpráva:"),
+ ("Models", "Modely"),
+ ("motion graphics and visual effects", "pohyblivá grafika a vizuální efekty"),
("Move Panel", "Přesunout panel"),
+ ("Name (A–Z)", "Jméno (A–Z)"),
+ ("New Cell Style", "Nový styl buňky"),
+ ("New Table Style", "Nový styl tabulky"),
+ ("No contributor data was built into this copy.", "Do této kopie nebyla zabudována data o přispěvatelích."),
+ ("No matches", "Žádné shody"),
+ ("No model credits were built into this copy.", "Do této kopie nebyly zabudovány údaje o modelech."),
("Note Tool", "Nástroj Poznámka"),
("Object & Layout", "Objekt a rozvržení"),
+ ("Object Style", "Styl objektu"),
("Organization:", "Organizace:"),
("Packaged {count} files into {dir}", "Sbaleno souborů: {count} do {dir}"),
("Page Tool", "Nástroj Stránka"),
+ ("Paragraph Style", "Styl odstavce"),
("PDF import cancelled: the originating document has closed", "Import PDF zrušen: původní dokument byl zavřen"),
("Pen Tool", "Nástroj Pero"),
("Pencil Tool", "Nástroj Tužka"),
("Phone:", "Telefon:"),
+ ("photo library and raw development", "knihovna fotografií a vyvolávání RAW"),
("Pin Bar Position", "Připnout polohu lišty"),
("Polygon Frame Tool", "Nástroj Mnohoúhelníkový rámeček"),
("Polygon Tool", "Nástroj Mnohoúhelník"),
+ ("Press keys…", "Stiskněte klávesy…"),
("Preview Record", "Náhled záznamu"),
+ ("Range:", "Rozsah:"),
+ ("reading, organizing and protecting PDFs", "čtení, správa a ochrana PDF"),
+ ("Real name", "Skutečné jméno"),
("Rectangle Frame Tool", "Nástroj Obdélníkový rámeček"),
("Rectangle Tool", "Nástroj Obdélník"),
+ ("Redefine Document Style", "Předefinovat styl dokumentu"),
("Relinked {count}", "Znovu propojeno: {count}"),
("Remove Data Source", "Odebrat zdroj dat"),
("Remove Field", "Odebrat pole"),
+ ("Report an issue", "Nahlásit problém"),
("Reset Bar Position", "Obnovit polohu lišty"),
("Resize panel window", "Změnit velikost okna panelu"),
("Resize panels", "Změnit velikost panelů"),
+ ("Reverse the order", "Obrátit pořadí"),
("Rotate Tool", "Nástroj Otočení"),
("Scale Tool", "Nástroj Změna měřítka"),
("Scissors Tool", "Nástroj Nůžky"),
@@ -1802,21 +1846,34 @@ pub(super) const TABLE: &[(&str, &str)] = &[
("Shear Tool", "Nástroj Zkosení"),
("Smooth Tool", "Nástroj Vyhladit"),
("Stop Preview", "Ukončit náhled"),
+ ("Story Editor — {count} words", "Editor textu – počet slov: {count}"),
+ ("Story {story} ← story {parent}", "Text {story} ← text {parent}"),
("Subject:", "Předmět:"),
+ ("Text Anchor", "Textová kotva"),
("Text:", "Text:"),
("the default printer", "výchozí"),
("Type on a Path Tool", "Nástroj Text na cestě"),
("Type Tool", "Nástroj Text"),
("Unsaved Changes", "Neuložené změny"),
("Update Data Source", "Aktualizovat zdroj dat"),
+ ("Use Document Style Definition", "Použít definici stylu v dokumentu"),
+ ("Username", "Uživatelské jméno"),
("Validate from Root Element", "Ověřit od kořenového prvku"),
+ ("vector illustration", "vektorová ilustrace"),
("Vertical Type on a Path Tool", "Nástroj Svislý text na cestě"),
("Vertical Type Tool", "Nástroj Svislý text"),
+ ("video editing, color and sound", "střih videa, barvy a zvuk"),
("W:", "Š:"),
("Zoom Tool", "Nástroj Lupa"),
+ ("% of all commits", "% všech commitů"),
("(any)", "(libovolná)"),
("(unchanged)", "(beze změny)"),
("[No Language]", "[Žádný jazyk]"),
+ ("{contributors} contributors · {commits} commits", "{contributors} přispěvatelů · {commits} commitů"),
+ ("{count} conflict(s): {names}", "Konflikty ({count}): {names}"),
+ ("{count} match(es)", "Shod: {count}"),
+ ("{count} replacement(s) made", "Provedeno nahrazení: {count}"),
+ ("{label}: {name} (double-click: Color Picker)", "{label}: {name} (dvojklik: Výběr barvy)"),
(
"{name}: import cancelled while a dialog is open; choose the file again",
"{name}: import byl zrušen, protože je otevřený dialog; vyberte soubor znovu",
@@ -1834,7 +1891,9 @@ pub(super) const PLURALS: &[(&str, [&str; 3])] = &[
("error", ["chyba", "chyby", "chyb"]),
("errors", ["chyba", "chyby", "chyb"]),
("warnings", ["varování", "varování", "varování"]),
+ ("layer", ["vrstva", "vrstvy", "vrstev"]),
+ ("layers", ["vrstva", "vrstvy", "vrstev"]),
];
/// Contexts whose Czech noun differs from the shared action label.
-pub(super) const CONTEXT: &[(&str, &str, &str)] = &[("Group", "selection", "Skupina")];
+pub(super) const CONTEXT: &[(&str, &str, &str)] = &[("Group", "selection", "Skupina"), ("Name", "contributors", "Jméno")];
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index aa91b45f3..45be9b338 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -2198,7 +2198,7 @@ pub fn palette(app: &mut DesignApp, ctx: &egui::Context) {
if let Some(sc) = &it.shortcut {
b = b.shortcut_text(shortcut_text(sc));
} else if !it.kind.is_empty() {
- b = b.shortcut_text(it.kind);
+ b = b.shortcut_text(crate::i18n::tr(&app.ui.language, it.kind));
}
// The button aligns its label by the layout it's in: left, like the rows with a shortcut.
let size = egui::vec2(460.0, 22.0);
diff --git a/crates/ui-egui/src/panels/interactive.rs b/crates/ui-egui/src/panels/interactive.rs
index ec0066133..ce795857b 100644
--- a/crates/ui-egui/src/panels/interactive.rs
+++ b/crates/ui-egui/src/panels/interactive.rs
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
use crate::DesignApp;
use crate::theme::Tokens;
-fn dest_text(d: &Value) -> String {
+fn dest_text(lang: &str, d: &Value) -> String {
if let Some(u) = d.get("url").and_then(Value::as_str) {
return u.to_string();
}
@@ -13,7 +13,7 @@ fn dest_text(d: &Value) -> String {
return format!("mailto:{e}");
}
if let Some(p) = d.get("page").and_then(Value::as_u64) {
- return format!("Page {}", p + 1);
+ return format!("{} {}", crate::i18n::tr(lang, "Page"), p + 1);
}
d.to_string()
}
@@ -55,7 +55,7 @@ pub fn hyperlinks(app: &mut DesignApp, ui: &mut egui::Ui) {
for h in list {
let hid = h["id"].clone();
ui.horizontal(|ui| {
- let r = ui.selectable_label(false, h["name"].as_str().unwrap_or("")).on_hover_text(dest_text(&h["dest"]));
+ let r = ui.selectable_label(false, h["name"].as_str().unwrap_or("")).on_hover_text(dest_text(&app.ui.language, &h["dest"]));
if r.clicked() {
let _ = app.run("hyperlink.goToSource", json!({"id": hid}));
}
@@ -88,7 +88,10 @@ pub fn bookmarks(app: &mut DesignApp, ui: &mut egui::Ui) {
for (i, b) in list.iter().enumerate() {
let page = b["page"].as_u64().unwrap_or(0) as usize;
ui.horizontal(|ui| {
- if ui.selectable_label(false, b["name"].as_str().unwrap_or("")).on_hover_text(format!("Page {}", app.session.page_label(page))).clicked()
+ if ui
+ .selectable_label(false, b["name"].as_str().unwrap_or(""))
+ .on_hover_text(format!("{} {}", crate::i18n::tr(&app.ui.language, "Page"), app.session.page_label(page)))
+ .clicked()
{
crate::canvas::go_to_page(app, page);
}
diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs
index a9c842116..38b808168 100644
--- a/crates/ui-egui/src/panels/layers.rs
+++ b/crates/ui-egui/src/panels/layers.rs
@@ -231,10 +231,10 @@ pub fn show(app: &mut DesignApp, ui: &mut Ui) {
ui.horizontal(|ui| {
ui.label(
egui::RichText::new(format!(
- "Page: {}, {} Layer{}",
+ "{}: {}, {}",
+ crate::i18n::tr(&app.ui.language, "Page"),
app.session.page_label(cur),
- doc.layers.len(),
- if doc.layers.len() == 1 { "" } else { "s" }
+ crate::i18n::count_label(&app.ui.language, if doc.layers.len() == 1 { "layer" } else { "layers" }, doc.layers.len())
))
.size(11.0)
.color(t.text_dim),
diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs
index 7478624a9..2b0e9be72 100644
--- a/crates/ui-egui/src/panels/properties.rs
+++ b/crates/ui-egui/src/panels/properties.rs
@@ -572,7 +572,11 @@ fn appearance_section(app: &mut DesignApp, ui: &mut Ui, i: &SelInfo) {
let chip = sub(b, 4.0, 2.0, 17.0, 17.0);
widgets::paint_chip(ui.painter(), chip, fc, fg);
ui.painter().rect_stroke(chip, 0.0, Stroke::new(1.0, t.field_border), StrokeKind::Inside);
- let resp = ui.interact(chip, ui.id().with("fillchip"), Sense::click()).on_hover_text(format!("Fill: {}", i.fill));
+ let resp = ui.interact(chip, ui.id().with("fillchip"), Sense::click()).on_hover_text(format!(
+ "{}: {}",
+ crate::i18n::tr(&app.ui.language, "Fill"),
+ i.fill
+ ));
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, "Fill swatch"));
swatch_menu(app, &resp, &doc, &i.fill, |app, n| {
let _ = app.run("object.fill", json!({"swatch": n}));
@@ -592,7 +596,11 @@ fn appearance_section(app: &mut DesignApp, ui: &mut Ui, i: &SelInfo) {
let chip = sub(b, 4.0, 2.0, 17.0, 17.0);
widgets::paint_stroke_chip(ui.painter(), chip, sc, egui::Color32::from_gray(20));
ui.painter().rect_stroke(chip, 0.0, Stroke::new(1.0, t.field_border), StrokeKind::Inside);
- let resp = ui.interact(chip, ui.id().with("strokechip"), Sense::click()).on_hover_text(format!("Stroke: {}", i.stroke));
+ let resp = ui.interact(chip, ui.id().with("strokechip"), Sense::click()).on_hover_text(format!(
+ "{}: {}",
+ crate::i18n::tr(&app.ui.language, "Stroke"),
+ i.stroke
+ ));
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, "Stroke swatch"));
swatch_menu(app, &resp, &doc, &i.stroke, |app, n| {
let _ = app.run("object.stroke", json!({"swatch": n}));
@@ -690,7 +698,16 @@ fn align_row(app: &mut DesignApp, ui: &mut Ui) {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 8.0;
let to = app.ui.align_to.clone();
- let resp = icon_toggle(ui, "align-to", false, &format!("Align To: {to}"));
+ let to_label = match to.as_str() {
+ "selection" => "Selection",
+ "keyObject" => "Key Object",
+ "margins" => "Margins",
+ "page" => "Page",
+ "spread" => "Spread",
+ other => other,
+ };
+ let tip = format!("{}: {}", crate::i18n::tr(&app.ui.language, "Align To"), crate::i18n::tr(&app.ui.language, to_label));
+ let resp = icon_toggle(ui, "align-to", false, &tip);
egui::Popup::menu(&resp).show(|ui| {
for (label, id) in [
("Align to Selection", "selection"),
@@ -1796,7 +1813,12 @@ pub fn links_panel(app: &mut DesignApp, ui: &mut egui::Ui) {
for l in &stories {
let out = l["outOfDate"].as_bool().unwrap_or(false);
ui.horizontal(|ui| {
- crate::rtl::label(ui, format!("Story {} ← story {}", l["story"], l["parent"]));
+ crate::rtl::label(
+ ui,
+ crate::i18n::tr(&app.ui.language, "Story {story} ← story {parent}")
+ .replace("{story}", &l["story"].to_string())
+ .replace("{parent}", &l["parent"].to_string()),
+ );
if out {
crate::rtl::label(
ui,
diff --git a/crates/ui-egui/src/panels/swatches.rs b/crates/ui-egui/src/panels/swatches.rs
index 1aa11ddb3..9fabf5178 100644
--- a/crates/ui-egui/src/panels/swatches.rs
+++ b/crates/ui-egui/src/panels/swatches.rs
@@ -226,7 +226,11 @@ pub fn color_panel(app: &mut DesignApp, ui: &mut egui::Ui) {
if k == stroke {
ui.painter().rect_stroke(r, 2.0, egui::Stroke::new(1.5, t.accent), egui::StrokeKind::Inside);
}
- let resp = resp.on_hover_text(format!("{label}: {n} (double-click: Color Picker)"));
+ let resp = resp.on_hover_text(
+ crate::i18n::tr(&app.ui.language, "{label}: {name} (double-click: Color Picker)")
+ .replace("{label}", crate::i18n::tr(&app.ui.language, label))
+ .replace("{name}", n),
+ );
if resp.clicked() {
stroke = k;
}
diff --git a/crates/ui-egui/src/panels/table.rs b/crates/ui-egui/src/panels/table.rs
index ce3080612..c1e80bd44 100644
--- a/crates/ui-egui/src/panels/table.rs
+++ b/crates/ui-egui/src/panels/table.rs
@@ -76,7 +76,15 @@ pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {
}
}
});
- if crate::icons::button(ui, "plus", 20.0, false, &format!("New {label}")).clicked() {
+ if crate::icons::button(
+ ui,
+ "plus",
+ 20.0,
+ false,
+ crate::i18n::tr(&app.ui.language, if kind == "cell" { "New Cell Style" } else { "New Table Style" }),
+ )
+ .clicked()
+ {
if kind == "cell" {
run(app, "style.cell.create", json!({"name": "Cell Style 1", "fromSelection": true}));
} else {
@@ -141,7 +149,7 @@ pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {
});
if ui
.button(crate::rtl::widget(ui, crate::i18n::tr(&app.ui.language, "Distribute Rows Evenly")))
- .on_hover_text("Equal fixed heights for the selected rows; cell text may become overset.")
+ .on_hover_text(crate::i18n::tr(&app.ui.language, "Equal fixed heights for the selected rows; cell text may become overset."))
.clicked()
&& let Err(e) = app.run("table.distributeRows", json!({}))
{
diff --git a/crates/ui-egui/src/story_editor.rs b/crates/ui-egui/src/story_editor.rs
index 5b093ab41..19beb1384 100644
--- a/crates/ui-egui/src/story_editor.rs
+++ b/crates/ui-egui/src/story_editor.rs
@@ -23,7 +23,8 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
let overset = cs.overset_at;
let mut open = true;
let mut edit: Option<(usize, usize, String)> = None;
- egui::Window::new(format!("Story Editor — {} words", story.text.split_whitespace().count()))
+ let words = story.text.split_whitespace().count().to_string();
+ egui::Window::new(crate::i18n::tr(&app.ui.language, "Story Editor — {count} words").replace("{count}", &words))
.id(egui::Id::new("story_editor"))
.open(&mut open)
.default_size(vec2(560.0, 520.0))
diff --git a/crates/ui-egui/src/taskbar.rs b/crates/ui-egui/src/taskbar.rs
index cf66e9d5f..9e48d073f 100644
--- a/crates/ui-egui/src/taskbar.rs
+++ b/crates/ui-egui/src/taskbar.rs
@@ -164,7 +164,7 @@ fn text_controls(app: &mut DesignApp, ui: &mut Ui, in_text: bool) {
if let Some(doc) = app.session.active().map(|d| d.doc.clone()) {
let sw = c["fill"].as_str().unwrap_or("[Black]").to_string();
let (col, g) = widgets::swatch_colors(&doc, &sw, 1.0);
- let resp = widgets::swatch_chip(ui, 17.0, col, g).on_hover_text(format!("Fill: {sw}"));
+ let resp = widgets::swatch_chip(ui, 17.0, col, g).on_hover_text(format!("{}: {sw}", crate::i18n::tr(&app.ui.language, "Fill")));
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, "Task Bar fill"));
let mut picked = None;
egui::Popup::menu(&resp).show(|ui| {