diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 093e88cd8..d027df9fd 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1745,6 +1745,8 @@ fn format_cells(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dialog, confirm: } } +/// Insert Function: searches names (as the formula language spells them) and descriptions, shows +/// each hit's category and description, and starts editing `=NAME(` (or appends to the formula). fn insert_function(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dialog, confirm: &mut bool) { let language = app.ui.language; ui.horizontal(|ui| { diff --git a/crates/ui-egui/src/formula_locale.rs b/crates/ui-egui/src/formula_locale.rs index 11b551b10..c34e3cf86 100644 --- a/crates/ui-egui/src/formula_locale.rs +++ b/crates/ui-egui/src/formula_locale.rs @@ -160,10 +160,13 @@ pub(crate) fn display_template(text: &str, locale: FormulaLocale, wb: &Workbook, mod tests { use super::*; + /// The hint for `name`, empty when there is none. fn sig(name: &str, locale: FormulaLocale, language: Language) -> String { signature(name, locale, language).unwrap_or_default() } + /// Hints keep the formula syntax's name and separators and translate the argument names + /// only when the interface language has them all. #[test] fn function_help_follows_the_interface_language_and_the_formula_syntax() { use FormulaLocale::{En, Es}; diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 016441ced..fcc59bf3d 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -158,6 +158,7 @@ impl Language { /// English text and its translation, sorted by the English. type HelpTable = &'static [(&'static str, &'static str)]; +/// The translation of `english` in a help table (binary search, so the table must stay sorted). fn lookup(table: HelpTable, english: &str) -> Option<&'static str> { let i = table.binary_search_by(|(key, _)| (*key).cmp(english)).ok()?; table.get(i).map(|(_, translated)| *translated) @@ -623,6 +624,7 @@ const JAPANESE: &[(&str, &str)] = &[ mod tests { use super::*; + /// Help tables are sorted, unique, and keyed by text the function catalog still has. #[test] fn function_help_is_sorted_and_keyed_by_current_catalog_text() { // Lookups binary-search the tables. A key that no longer matches the catalog (an English diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index b25ce4b2e..f0b74089a 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -1749,6 +1749,8 @@ fn page_layout(app: &mut SheetApp, ui: &mut Ui) { } } +/// The Formulas tab: Insert Function, AutoSum, the function-category menus (names in the formula +/// language, descriptions in the interface language), defined names, auditing and calculation. fn formulas(app: &mut SheetApp, ui: &mut Ui) { let __k = big_button(ui, Icon::Function, "Insert\nFunction", "Insert Function (⇧F3)", false); control_keytip(app, ui, &__k, "dialog:insertFunction");