Counts read in the singular for one thing; parts build two-count messages (R2.11)
This commit is contained in:
22 files changed
+130
-49
No files matched your search
@@ -24,17 +24,18 @@ impl Docs {
|
||||
let Some(counts) = self.active_tab().and_then(|tab| tab.extra.counts) else {
|
||||
return status.when_some(zoom, |status, zoom| status.right(zoom));
|
||||
};
|
||||
let (words, characters) = (counts.words.to_string(), counts.characters.to_string());
|
||||
let count = |key, n: u64| ely_ui::i18n::counted(cx, key, n, &[("n", &n.to_string())]);
|
||||
let label = match counts.selected_words {
|
||||
0 => Self::text(
|
||||
cx,
|
||||
"doc.count.words",
|
||||
&[("words", &words), ("characters", &characters)],
|
||||
),
|
||||
selected => Self::text(
|
||||
0 => {
|
||||
let words = count("doc.count.word", counts.words);
|
||||
let characters = count("doc.count.character", counts.characters);
|
||||
Self::text(cx, "doc.count.words", &[("words", &words), ("characters", &characters)])
|
||||
}
|
||||
selected => ely_ui::i18n::counted(
|
||||
cx,
|
||||
"doc.count.selected",
|
||||
&[("selected", &selected.to_string()), ("words", &words)],
|
||||
counts.words,
|
||||
&[("selected", &selected.to_string()), ("words", &counts.words.to_string())],
|
||||
),
|
||||
};
|
||||
status.right(StatusBarItem::new("doc-count").label(label)).when_some(zoom, |status, zoom| status.right(zoom))
|
||||
|
||||
@@ -260,9 +260,8 @@ impl Docs {
|
||||
let folder = folder.display().to_string();
|
||||
let text = match written {
|
||||
Ok(count) => {
|
||||
let count = count.to_string();
|
||||
let text =
|
||||
Docs::text(cx, "doc.merge.done", &[("n", &count), ("folder", &folder)]);
|
||||
let n = count.to_string();
|
||||
let text = ely_ui::i18n::counted(cx, "doc.merge.done", count as u64, &[("n", &n), ("folder", &folder)]);
|
||||
return docs.toast(text, Severity::Success, cx);
|
||||
}
|
||||
Err((n, error)) => Docs::text(
|
||||
|
||||
@@ -183,7 +183,7 @@ impl Viewer {
|
||||
written.map(|()| targets.len())
|
||||
},
|
||||
move |viewer, done, _, cx| match done {
|
||||
Ok(count) => viewer.toast_output(Self::text(cx, "pdf.split.done", &[("count", &count.to_string())]), opened.clone(), cx),
|
||||
Ok(count) => viewer.toast_output(ely_ui::i18n::counted(cx, "pdf.split.done", count as u64, &[("count", &count.to_string())]), opened.clone(), cx),
|
||||
Err(error) => viewer.failed_write(&stem, &error, cx),
|
||||
},
|
||||
cx,
|
||||
@@ -205,8 +205,7 @@ impl Viewer {
|
||||
};
|
||||
let card = match self.ask.as_ref()? {
|
||||
Ask::Crop { pages, margins, .. } => {
|
||||
let count = pages.len().to_string();
|
||||
let title = Self::text(cx, "pdf.crop.title", &[("count", &count)]);
|
||||
let title = ely_ui::i18n::counted(cx, "pdf.crop.title", pages.len() as u64, &[("count", &pages.len().to_string())]);
|
||||
let sides = ["top", "right", "bottom", "left"];
|
||||
let rows = sides.iter().enumerate().fold(DescriptionList::new(), |rows, (at, side)| {
|
||||
let name = label(&format!("pdf.crop.{side}"));
|
||||
|
||||
@@ -161,7 +161,7 @@ impl Viewer {
|
||||
cx.notify();
|
||||
let pages: Vec<(usize, Vec<OcrLine>)> = run.read.into_iter().filter(|(_, lines)| replace || !lines.is_empty()).collect();
|
||||
let (read, skipped) = (pages.len().to_string(), run.skipped.to_string());
|
||||
let summary = Self::text(cx, "pdf.ocr.done", &[("read", &read), ("skipped", &skipped)]);
|
||||
let summary = ely_ui::i18n::counted(cx, "pdf.ocr.done", pages.len() as u64, &[("read", &read), ("skipped", &skipped)]);
|
||||
let Some(view) = self.tab(tab).map(|tab| tab.view.clone()).filter(|_| !pages.is_empty()) else {
|
||||
return self.toast(summary, Severity::Info, cx);
|
||||
};
|
||||
|
||||
@@ -177,7 +177,7 @@ impl Viewer {
|
||||
},
|
||||
move |viewer, done, _, cx| match done {
|
||||
Ok(count) => {
|
||||
let text = Self::text(cx, "pdf.export.images_done", &[("count", &count.to_string())]);
|
||||
let text = ely_ui::i18n::counted(cx, "pdf.export.images_done", count as u64, &[("count", &count.to_string())]);
|
||||
match folder.clone() {
|
||||
Some(folder) => viewer.toast_output(text, folder, cx),
|
||||
None => viewer.toast(text, Severity::Success, cx),
|
||||
|
||||
@@ -185,7 +185,7 @@ impl Viewer {
|
||||
},
|
||||
move |viewer, done, _, cx| match done {
|
||||
Ok(0) => viewer.toast_output(Self::text(cx, "pdf.clean.done", &[("name", &shown)]), opened.clone(), cx),
|
||||
Ok(n) => viewer.toast_output(Self::text(cx, "pdf.redact.done", &[("name", &shown), ("count", &n.to_string())]), opened.clone(), cx),
|
||||
Ok(n) => viewer.toast_output(ely_ui::i18n::counted(cx, "pdf.redact.done", n as u64, &[("name", &shown), ("count", &n.to_string())]), opened.clone(), cx),
|
||||
Err(error) => viewer.failed(&error, cx),
|
||||
},
|
||||
cx,
|
||||
@@ -200,8 +200,8 @@ impl Viewer {
|
||||
let (title, body) = match removal {
|
||||
Removal::Clean { reach, what, .. } => ("pdf.clean.title", self.clean_rows(reach, *what, &this, cx)),
|
||||
Removal::Redact { regions, .. } => {
|
||||
let count = regions.len().to_string();
|
||||
("pdf.redact.title", div().child(Self::text(cx, "pdf.redact.count", &[("count", &count)])).into_any_element())
|
||||
let count = ely_ui::i18n::counted(cx, "pdf.redact.count", regions.len() as u64, &[("count", ®ions.len().to_string())]);
|
||||
("pdf.redact.title", div().child(count).into_any_element())
|
||||
}
|
||||
};
|
||||
let title = Self::text(cx, title, &[("name", &name)]);
|
||||
|
||||
@@ -292,8 +292,8 @@ impl Deck {
|
||||
},
|
||||
move |deck, written, _, cx| match written {
|
||||
Ok(count) => {
|
||||
let count = count.to_string();
|
||||
let text = Deck::text(cx, "show.output.pictures_done", &[("n", &count), ("folder", &shown)]);
|
||||
let n = count.to_string();
|
||||
let text = ely_ui::i18n::counted(cx, "show.output.pictures_done", count as u64, &[("n", &n), ("folder", &shown)]);
|
||||
deck.toast_output(text, opened.clone(), cx);
|
||||
}
|
||||
Err(error) if error.kind() == io::ErrorKind::AlreadyExists => {
|
||||
|
||||
@@ -311,7 +311,7 @@ impl Book {
|
||||
move |book, picked, _, window, cx| {
|
||||
let (c1, _, c2, _) = picked.area.expect("a data area");
|
||||
if c1 != c2 {
|
||||
return book.warn_key("table.columns.one", cx);
|
||||
return book.warn_key("table.columns.same", cx);
|
||||
}
|
||||
let other = cx.new(|cx| TextInput::new(window, cx));
|
||||
book.dialog = Some(Dialog::Columns {
|
||||
|
||||
@@ -114,19 +114,15 @@ pub(crate) fn delete(
|
||||
let mut detail = if references.formulas + references.names == 0 {
|
||||
Book::text(cx, "table.delete.alone", &[])
|
||||
} else {
|
||||
Book::text(
|
||||
cx,
|
||||
"table.delete.refs",
|
||||
&[
|
||||
("formulas", &references.formulas.to_string()),
|
||||
("first", &references.first),
|
||||
("names", &references.names.to_string()),
|
||||
],
|
||||
)
|
||||
let count = |key, n: u64| ely_ui::i18n::counted(cx, key, n, &[("n", &n.to_string())]);
|
||||
let formulas = count("table.delete.formulas", references.formulas);
|
||||
let names = count("table.delete.names", references.names);
|
||||
let args = [("formulas", formulas.as_ref()), ("first", &references.first), ("names", &names)];
|
||||
Book::text(cx, "table.delete.refs", &args)
|
||||
};
|
||||
if references.dynamic > 0 {
|
||||
let count = references.dynamic.to_string();
|
||||
let dynamic = Book::text(cx, "table.delete.dynamic", &[("count", &count)]);
|
||||
let dynamic = ely_ui::i18n::counted(cx, "table.delete.dynamic", references.dynamic, &[("count", &count)]);
|
||||
detail = format!("{detail} {dynamic}").into();
|
||||
}
|
||||
let label = Book::text(cx, "table.delete.go", &[]);
|
||||
|
||||
@@ -95,9 +95,10 @@ impl Tree {
|
||||
Ask::Force { repo, plan } => {
|
||||
let lost = match plan.lost.len() {
|
||||
0 => label("tree.force.nothing"),
|
||||
n => text(
|
||||
n => ely_ui::i18n::counted(
|
||||
cx,
|
||||
"tree.force.lost",
|
||||
n as u64,
|
||||
&[("n", &n.to_string()), ("commits", &plan.lost.join("\n"))],
|
||||
),
|
||||
};
|
||||
|
||||
@@ -101,8 +101,8 @@ impl Tree {
|
||||
};
|
||||
let lines = (!shown.picked.is_empty() && self.partial(shown)).then(|| {
|
||||
let this = this.clone();
|
||||
let n = shown.picked.len().to_string();
|
||||
Button::new("tree-lines", text(cx, key, &[("n", &n)]))
|
||||
let n = shown.picked.len();
|
||||
Button::new("tree-lines", ely_ui::i18n::counted(cx, key, n as u64, &[("n", &n.to_string())]))
|
||||
.variant(ButtonVariant::Primary)
|
||||
.size(ControlSize::Sm)
|
||||
.on_click(move |_, _, cx| {
|
||||
|
||||
@@ -205,9 +205,10 @@ impl Tree {
|
||||
let short = |oid: &str| oid[..oid.len().min(7)].to_string();
|
||||
let left = match plan.left.len() {
|
||||
0 => label("tree.move.nothing"),
|
||||
n => text(
|
||||
n => ely_ui::i18n::counted(
|
||||
cx,
|
||||
"tree.move.left",
|
||||
n as u64,
|
||||
&[("n", &n.to_string()), ("commits", &plan.left.join("\n"))],
|
||||
),
|
||||
};
|
||||
|
||||
@@ -213,7 +213,7 @@ impl Tree {
|
||||
0 => (IconName::CircleCheck, text(cx, "tree.clean", &[])),
|
||||
n => (
|
||||
IconName::GitBranch,
|
||||
text(cx, "tree.changed", &[("n", &n.to_string())]),
|
||||
ely_ui::i18n::counted(cx, "tree.changed", n as u64, &[("n", &n.to_string())]),
|
||||
),
|
||||
};
|
||||
EmptyState::new(("tree-summary", opened.id), icon, title).into_any_element()
|
||||
|
||||
Reference in new issue
Block a user