1use std::fmt::Write as _;
4
5use ravenrs_app_i18n::{Language, Texts, format_with};
6
7use crate::context::{BuildCx, NodeId};
8use crate::date::Date;
9use crate::grid::Summary;
10use crate::recurrence::{Frequency, RecurrenceEnd, RecurrenceRule};
11use crate::view::View;
12
13#[derive(Clone, Debug)]
17#[non_exhaustive]
18#[cfg_attr(feature = "live", ravenrs_live::expose(part = "fields"))]
19pub struct Labels {
20 pub close: String,
22 pub help: String,
24 pub navigation: String,
26 pub toggle_sidebar: String,
28 pub dismiss: String,
30 pub send: String,
32 pub listen: String,
34 pub tree_name: String,
36 pub tag_remove: String,
38 pub pick_color: String,
40 pub no_color: String,
42 pub color_shade: String,
44 pub color_hue: String,
46 pub color_alpha: String,
48 pub color_hex: String,
50 pub pick_date_range: String,
52 pub candle_open: String,
54 pub candle_high: String,
56 pub candle_low: String,
58 pub candle_close: String,
60 pub sankey_cycle: String,
63 pub list_name: String,
65 pub filmstrip_name: String,
67 pub document_name: String,
69 pub page_word: String,
71 pub page_of: String,
73 pub previous_page: String,
75 pub next_page: String,
77 pub file_browser_name: String,
79 pub file_name: String,
81 pub file_size: String,
83 pub attachments: String,
85 pub attachment_remove: String,
87 pub attachment_send_as: String,
89 pub selection_bar: String,
91 pub selection_exit: String,
93 pub selection_none: String,
95 pub selection_one: String,
97 pub selection_many: String,
99 pub audio_player: String,
101 pub audio_play: String,
103 pub audio_stop: String,
105 pub audio_loading: String,
107 pub audio_transcript: String,
109 pub audio_transcribe: String,
111 pub audio_transcribing: String,
113 pub audio_no_speech: String,
115 pub chat_photo: String,
117 pub chat_photo_loading: String,
119 pub chat_open: String,
121 pub file_modified: String,
123 pub folder_word: String,
125 pub folder_empty: String,
127 pub previous_year: String,
129 pub next_year: String,
131 pub day_marked: String,
133 pub sortable_name: String,
135 pub sortable_hint: String,
137 pub moved_to: String,
139 pub document_tabs_name: String,
141 pub dock_area_name: String,
143 pub dock_tabs_name: String,
145 pub dock_empty: String,
147 pub dock_left: String,
149 pub dock_right: String,
151 pub dock_bottom: String,
153 pub dock_center: String,
155 pub dock_move_to: String,
157 pub dock_with: String,
159 pub dock_split_right: String,
161 pub dock_split_below: String,
163 pub dock_close: String,
165 pub dock_reopen: String,
167 pub dock_close_panel: String,
169 pub dock_options: String,
171 pub dock_hide: String,
173 pub dock_show: String,
175 pub dock_resize: String,
177 pub dock_resize_pair: String,
179 pub dock_moved: String,
181 pub dock_closed: String,
183 pub close_tab: String,
185 pub new_tab: String,
187 pub close_other_tabs: String,
189 pub close_tabs_to_right: String,
191 pub unsaved: String,
193 pub wizard_back: String,
195 pub wizard_next: String,
197 pub wizard_finish: String,
199 pub wizard_cancel: String,
201 pub wizard_done: String,
203 pub wizard_error: String,
205 pub split_resize: String,
207 pub panel_move: String,
209 pub panel_minimize: String,
211 pub panel_restore: String,
213 pub scroll_back: String,
215 pub scroll_forward: String,
217 pub window_minimize: String,
219 pub window_maximize: String,
221 pub window_restore: String,
223 pub value_adjust: String,
225 pub rename: String,
227 pub rename_hint: String,
229 pub file_drop: String,
231 pub file_choose: String,
233 pub file_remove: String,
235 pub file_wrong_kind: String,
237 pub file_too_large: String,
239 pub file_too_many: String,
241 pub image_choose: String,
243 pub image_replace: String,
245 pub image_none: String,
247 pub image_invalid: String,
249 pub tile_move: String,
251 pub tile_resize: String,
253 pub cards_name: String,
255 pub grid_expand_row: String,
257 pub grid_collapse_row: String,
259 pub tag_add: String,
262 pub wizard_progress: String,
265 pub culture: String,
267 pub loading: String,
269 pub decrease: String,
271 pub increase: String,
273 pub required: String,
275 pub pick_date: String,
277 pub select: String,
279 pub search: String,
281 pub no_results: String,
283 pub search_commands: String,
285 pub no_commands: String,
287 pub command_palette: String,
289 pub theme: String,
291 pub theme_dark: String,
293 pub theme_light: String,
295 pub theme_glass: String,
297 pub theme_surfaces: String,
299 pub theme_text: String,
301 pub theme_accent: String,
303 pub theme_status: String,
305 pub theme_shape: String,
307 pub theme_sizes: String,
309 pub theme_restore: String,
311 pub theme_copy: String,
313 pub theme_paste: String,
315 pub theme_invalid: String,
317 pub theme_changed: [String; 3],
320 pub theme_contrast: String,
323 pub copy: String,
325 pub copied: String,
327 pub release_versions: String,
329 pub release_newer: String,
331 pub release_older: String,
333 pub release_of: String,
335 pub diagnostics: String,
337 pub diagnostics_test: String,
339 pub diagnostics_testing: String,
341 pub diagnostics_testing_detail: String,
343 pub diagnostics_test_good: String,
345 pub diagnostics_test_fair: String,
347 pub diagnostics_test_poor: String,
349 pub diagnostics_test_fps: String,
351 pub diagnostics_test_cause_none: String,
353 pub diagnostics_timeline: String,
355 pub diagnostics_timeline_detail: String,
357 pub diagnostics_why: String,
359 pub diagnostics_why_none: String,
361 pub diagnostics_causes: [String; 10],
363 pub diagnostics_views: String,
365 pub diagnostics_batches: String,
367 pub diagnostics_memory: String,
369 pub diagnostics_copy_trace: String,
371 pub diagnostics_test_cause_gpu: String,
373 pub diagnostics_test_cause_interface: String,
375 pub diagnostics_software: String,
377 pub diagnostics_software_detail: String,
379 pub diagnostics_unoptimized: String,
381 pub diagnostics_unoptimized_detail: String,
383 pub diagnostics_hidden: String,
385 pub diagnostics_no_gpu: String,
387 pub diagnostics_frame: String,
389 pub diagnostics_update: String,
391 pub diagnostics_acquire: String,
393 pub diagnostics_render: String,
395 pub diagnostics_report_bug: String,
397 pub diagnostics_report_shares: String,
399 pub diagnostics_report_shares_detail: String,
401 pub diagnostics_report_failed: String,
403 pub diagnostics_report_failed_detail: String,
405 pub diagnostics_report_questions: String,
407 pub diagnostics_report_truncated: String,
409 pub previous_month: String,
411 pub next_month: String,
413 pub today: String,
415 pub weekdays: [String; 7],
417 pub months: [String; 12],
419 pub month_year: String,
421 pub short_date: String,
425 pub form_errors: String,
427 pub clear: String,
429 pub filter_all: String,
431 pub filter_any: String,
433 pub filter_match: String,
435 pub filter_add_condition: String,
437 pub filter_add_group: String,
439 pub filter_remove: String,
441 pub filter_field: String,
443 pub filter_comparison: String,
445 pub filter_value: String,
447 pub filter_expression: String,
449 pub filter_yes: String,
451 pub filter_no: String,
453 pub filter_equal: String,
455 pub filter_not_equal: String,
457 pub filter_greater: String,
459 pub filter_greater_or_equal: String,
461 pub filter_less: String,
463 pub filter_less_or_equal: String,
465 pub filter_contains: String,
467 pub filter_starts_with: String,
469 pub filter_is_empty: String,
471 pub filter_is_not_empty: String,
473 pub filter_any_of: String,
475 pub filter_none_of: String,
477 pub ribbon: String,
479 pub ribbon_search: String,
481 pub ribbon_pin: String,
483 pub ribbon_collapse: String,
485 pub carousel_previous: String,
487 pub carousel_next: String,
489 pub carousel_slide: String,
491 pub verification_code: String,
493 pub cancel: String,
495 pub confirm_by_typing: String,
497 pub more_commands: String,
499 pub decimal_separator: char,
501 pub group_separator: char,
503 pub pick_time: String,
505 pub step_up: String,
507 pub step_down: String,
509 pub calendar_more: String,
511 pub scheduler_resources: String,
513 pub zoom_in: String,
515 pub zoom_out: String,
517 pub histogram: String,
519 pub histogram_clipped_low: String,
521 pub histogram_clipped_high: String,
523 pub ruler: String,
525 pub color_wheel: String,
527 pub color_saturation: String,
529 pub curve_editor: String,
531 pub curve_point: String,
533 pub curve_points: String,
535 pub curve_input: String,
537 pub curve_output: String,
539 pub zoom: String,
541 pub zoom_fit: String,
543 pub zoom_actual: String,
545 pub zoom_view: String,
547 pub minimap: String,
549 pub rubber_band: String,
551 pub marquee: String,
553 pub transform: String,
555 pub crop: String,
557 pub protractor: String,
559 pub eyedropper: String,
561 pub eyedropper_hint: String,
563 pub eyedropper_area: String,
565 pub compare: String,
567 pub compare_first: String,
569 pub compare_second: String,
571 pub lightbox: String,
573 pub lightbox_previous: String,
575 pub lightbox_next: String,
577 pub lightbox_counter: String,
580 pub recurrence_name: String,
582 pub recurrence_frequencies: [String; 5],
584 pub recurrence_every: String,
586 pub recurrence_units: [(String, String); 4],
588 pub recurrence_each: [String; 4],
590 pub recurrence_ends_name: String,
592 pub recurrence_ends: [String; 3],
594 pub recurrence_times: String,
596 pub recurrence_until: String,
598 pub recurrence_next: String,
600 pub grid_drag_hint: String,
602 pub grid_grouped_by: String,
604 pub grid_remove_group: String,
606 pub grid_expand_all: String,
608 pub grid_collapse_all: String,
610 pub grid_sort_ascending: String,
612 pub grid_sort_descending: String,
614 pub grid_clear_sort: String,
616 pub grid_group_by_column: String,
618 pub grid_ungroup_column: String,
620 pub grid_pin_column: String,
622 pub grid_unpin_column: String,
624 pub grid_hide_column: String,
626 pub grid_fit_column: String,
628 pub grid_show_panel: String,
630 pub grid_hide_panel: String,
632 pub grid_column_menu: String,
634 pub grid_filter_values: String,
636 pub grid_clear_filter: String,
638 pub expression_text: String,
640 pub expression_search: String,
642 pub expression_insert: String,
644 pub expression_valid: String,
646 pub expression_error_at: String,
648 pub expression_unknown: String,
650 pub expression_no_match: String,
652 pub expression_groups: [String; 10],
656 pub expression_operators: Vec<(String, String)>,
659 pub expression_constants: Vec<(String, String)>,
662 pub grid_filter_label: String,
664 pub grid_edit_filter: String,
666 pub grid_all_values: String,
668 pub grid_scenario: String,
670 pub grid_scenario_save: String,
672 pub grid_scenario_update: String,
674 pub grid_scenario_delete: String,
676 pub grid_scenario_original: String,
678 pub grid_scenario_name: String,
680 pub grid_save: String,
682 pub grid_rows_per_page: String,
684 pub grid_try_again: String,
686 pub grid_page: String,
688 pub grid_previous: String,
690 pub grid_next: String,
692 pub grid_edit_summary: String,
694 pub grid_summary_of: String,
696 pub grid_summary_none: String,
698 pub grid_summary_formula: String,
700 pub grid_formula_hint: String,
702 pub grid_formula_result: String,
704 pub grid_formula_error: String,
706 pub grid_formula_columns: String,
708 pub grid_formula_functions: String,
710 pub grid_apply: String,
712 pub grid_search: String,
714 pub grid_group: String,
716 pub grid_clear_grouping: String,
718 pub grid_columns: String,
720 pub grid_reset: String,
722 pub grid_export: String,
724 pub grid_export_file: String,
726 pub grid_add_row: String,
728 pub grid_delete_rows: String,
730 pub grid_no_rows: String,
732 pub grid_name: String,
734 pub grid_select_row: String,
736 pub grid_sorted_ascending: String,
738 pub grid_sorted_descending: String,
740 pub grid_filter_hint: String,
742 pub grid_number_filter_hint: String,
744 pub grid_filter_column: String,
746 pub grid_empty: String,
748 pub grid_of: String,
750 pub grid_rows: String,
752 pub grid_selected: String,
754 pub rating: String,
756 pub rating_value: String,
759 pub yesterday: String,
761 pub shortcut_sheet: String,
763 pub favorite: String,
765 pub swatches: String,
767 pub anchor_point: String,
769 pub anchor_names: [String; 9],
771 pub color_foreground: String,
773 pub color_background: String,
775 pub color_swap: String,
777 pub color_reset: String,
779 pub grid_summaries: [String; 5],
781 pub playground_run: String,
783 pub playground_restore: String,
785 pub playground_example: String,
787 pub playground_code: String,
789 pub playground_result: String,
791 pub playground_last_good: String,
793 pub playground_line: String,
795 pub playground_column: String,
797 pub playground_download: String,
799 pub playground_output: String,
801 pub playground_console: String,
803 pub playground_problems: String,
805 pub playground_no_problems: String,
807 pub playground_nothing_printed: String,
809 pub playground_clear_output: String,
811 pub playground_hide_output: String,
813 pub playground_show_output: String,
815 pub playground_more: String,
817 pub playground_full_screen: String,
819 pub playground_exit_full_screen: String,
821}
822
823impl Default for Labels {
824 fn default() -> Self {
825 Self::from_texts(&Texts::new(Language::English))
826 }
827}
828
829#[cfg_attr(feature = "live", ravenrs_live::expose)]
830impl Labels {
831 pub fn from_texts(texts: &Texts) -> Self {
833 Self {
834 close: texts.get("widgets.close"),
835 help: texts.get("widgets.help"),
836 navigation: texts.get("widgets.navigation"),
837 toggle_sidebar: texts.get("widgets.toggle_sidebar"),
838 dismiss: texts.get("widgets.dismiss"),
839 send: texts.get("widgets.send"),
840 listen: texts.get("widgets.listen"),
841 tree_name: texts.get("widgets.tree_name"),
842 tag_remove: texts.get("widgets.tag_remove"),
843 pick_color: texts.get("widgets.pick_color"),
844 no_color: texts.get("widgets.no_color"),
845 color_shade: texts.get("widgets.color_shade"),
846 color_hue: texts.get("widgets.color_hue"),
847 color_alpha: texts.get("widgets.color_alpha"),
848 color_hex: texts.get("widgets.color_hex"),
849 pick_date_range: texts.get("widgets.pick_date_range"),
850 candle_open: texts.get("widgets.candle_open"),
851 candle_high: texts.get("widgets.candle_high"),
852 candle_low: texts.get("widgets.candle_low"),
853 candle_close: texts.get("widgets.candle_close"),
854 sankey_cycle: texts.get("widgets.sankey_cycle"),
855 list_name: texts.get("widgets.list_name"),
856 filmstrip_name: texts.get("widgets.filmstrip_name"),
857 document_name: texts.get("widgets.document_name"),
858 page_word: texts.get("widgets.page_word"),
859 page_of: texts.get("widgets.page_of"),
860 previous_page: texts.get("widgets.previous_page"),
861 next_page: texts.get("widgets.next_page"),
862 file_browser_name: texts.get("widgets.file_browser_name"),
863 file_name: texts.get("widgets.file_name"),
864 file_size: texts.get("widgets.file_size"),
865 attachments: texts.get("widgets.attachments"),
866 attachment_remove: texts.get("widgets.attachment_remove"),
867 attachment_send_as: texts.get("widgets.attachment_send_as"),
868 selection_bar: texts.get("widgets.selection_bar"),
869 selection_exit: texts.get("widgets.selection_exit"),
870 selection_none: texts.get("widgets.selection_none"),
871 selection_one: texts.get("widgets.selection_one"),
872 selection_many: texts.get("widgets.selection_many"),
873 audio_player: texts.get("widgets.audio_player"),
874 audio_play: texts.get("widgets.audio_play"),
875 audio_stop: texts.get("widgets.audio_stop"),
876 audio_loading: texts.get("widgets.audio_loading"),
877 audio_transcript: texts.get("widgets.audio_transcript"),
878 audio_transcribe: texts.get("widgets.audio_transcribe"),
879 audio_transcribing: texts.get("widgets.audio_transcribing"),
880 audio_no_speech: texts.get("widgets.audio_no_speech"),
881 chat_photo: texts.get("widgets.chat_photo"),
882 chat_photo_loading: texts.get("widgets.chat_photo_loading"),
883 chat_open: texts.get("widgets.chat_open"),
884 file_modified: texts.get("widgets.file_modified"),
885 folder_word: texts.get("widgets.folder_word"),
886 folder_empty: texts.get("widgets.folder_empty"),
887 previous_year: texts.get("widgets.previous_year"),
888 next_year: texts.get("widgets.next_year"),
889 day_marked: texts.get("widgets.day_marked"),
890 sortable_name: texts.get("widgets.sortable_name"),
891 sortable_hint: texts.get("widgets.sortable_hint"),
892 moved_to: texts.get("widgets.moved_to"),
893 document_tabs_name: texts.get("widgets.document_tabs_name"),
894 dock_area_name: texts.get("widgets.dock_area_name"),
895 dock_tabs_name: texts.get("widgets.dock_tabs_name"),
896 dock_empty: texts.get("widgets.dock_empty"),
897 dock_left: texts.get("widgets.dock_left"),
898 dock_right: texts.get("widgets.dock_right"),
899 dock_bottom: texts.get("widgets.dock_bottom"),
900 dock_center: texts.get("widgets.dock_center"),
901 dock_move_to: texts.get("widgets.dock_move_to"),
902 dock_with: texts.get("widgets.dock_with"),
903 dock_split_right: texts.get("widgets.dock_split_right"),
904 dock_split_below: texts.get("widgets.dock_split_below"),
905 dock_close: texts.get("widgets.dock_close"),
906 dock_reopen: texts.get("widgets.dock_reopen"),
907 dock_close_panel: texts.get("widgets.dock_close_panel"),
908 dock_options: texts.get("widgets.dock_options"),
909 dock_hide: texts.get("widgets.dock_hide"),
910 dock_show: texts.get("widgets.dock_show"),
911 dock_resize: texts.get("widgets.dock_resize"),
912 dock_resize_pair: texts.get("widgets.dock_resize_pair"),
913 dock_moved: texts.get("widgets.dock_moved"),
914 dock_closed: texts.get("widgets.dock_closed"),
915 close_tab: texts.get("widgets.close_tab"),
916 new_tab: texts.get("widgets.new_tab"),
917 close_other_tabs: texts.get("widgets.close_other_tabs"),
918 close_tabs_to_right: texts.get("widgets.close_tabs_to_right"),
919 unsaved: texts.get("widgets.unsaved"),
920 wizard_back: texts.get("widgets.wizard_back"),
921 wizard_next: texts.get("widgets.wizard_next"),
922 wizard_finish: texts.get("widgets.wizard_finish"),
923 wizard_cancel: texts.get("widgets.wizard_cancel"),
924 wizard_done: texts.get("widgets.wizard_done"),
925 wizard_error: texts.get("widgets.wizard_error"),
926 split_resize: texts.get("widgets.split_resize"),
927 panel_move: texts.get("widgets.panel_move"),
928 panel_minimize: texts.get("widgets.panel_minimize"),
929 panel_restore: texts.get("widgets.panel_restore"),
930 scroll_back: texts.get("widgets.scroll_back"),
931 scroll_forward: texts.get("widgets.scroll_forward"),
932 window_minimize: texts.get("widgets.window_minimize"),
933 window_maximize: texts.get("widgets.window_maximize"),
934 window_restore: texts.get("widgets.window_restore"),
935 value_adjust: texts.get("widgets.value_adjust"),
936 rename: texts.get("widgets.rename"),
937 rename_hint: texts.get("widgets.rename_hint"),
938 file_drop: texts.get("widgets.file_drop"),
939 file_choose: texts.get("widgets.file_choose"),
940 file_remove: texts.get("widgets.file_remove"),
941 file_wrong_kind: texts.get("widgets.file_wrong_kind"),
942 file_too_large: texts.get("widgets.file_too_large"),
943 file_too_many: texts.get("widgets.file_too_many"),
944 image_choose: texts.get("widgets.image_choose"),
945 image_replace: texts.get("widgets.image_replace"),
946 image_none: texts.get("widgets.image_none"),
947 image_invalid: texts.get("widgets.image_invalid"),
948 tile_move: texts.get("widgets.tile_move"),
949 tile_resize: texts.get("widgets.tile_resize"),
950 cards_name: texts.get("widgets.cards_name"),
951 grid_expand_row: texts.get("widgets.grid_expand_row"),
952 grid_collapse_row: texts.get("widgets.grid_collapse_row"),
953 tag_add: texts.get("widgets.tag_add"),
954 wizard_progress: texts.get("widgets.wizard_progress"),
955 culture: texts.get("widgets.culture"),
956 loading: texts.get("widgets.loading"),
957 decrease: texts.get("widgets.decrease"),
958 increase: texts.get("widgets.increase"),
959 required: texts.get("widgets.required"),
960 pick_date: texts.get("widgets.pick_date"),
961 select: texts.get("widgets.select"),
962 search: texts.get("widgets.search"),
963 no_results: texts.get("widgets.no_results"),
964 search_commands: texts.get("widgets.search_commands"),
965 no_commands: texts.get("widgets.no_commands"),
966 command_palette: texts.get("widgets.command_palette"),
967 theme: texts.get("widgets.theme"),
968 theme_dark: texts.get("widgets.theme_dark"),
969 theme_light: texts.get("widgets.theme_light"),
970 theme_glass: texts.get("widgets.theme_glass"),
971 theme_surfaces: texts.get("widgets.theme_surfaces"),
972 theme_text: texts.get("widgets.theme_text"),
973 theme_accent: texts.get("widgets.theme_accent"),
974 theme_status: texts.get("widgets.theme_status"),
975 theme_shape: texts.get("widgets.theme_shape"),
976 theme_sizes: texts.get("widgets.theme_sizes"),
977 theme_restore: texts.get("widgets.theme_restore"),
978 theme_copy: texts.get("widgets.theme_copy"),
979 theme_paste: texts.get("widgets.theme_paste"),
980 theme_invalid: texts.get("widgets.theme_invalid"),
981 theme_changed: texts.array("widgets.theme_changed"),
982 theme_contrast: texts.get("widgets.theme_contrast"),
983 copy: texts.get("widgets.copy"),
984 copied: texts.get("widgets.copied"),
985 release_versions: texts.get("widgets.release_versions"),
986 release_newer: texts.get("widgets.release_newer"),
987 release_older: texts.get("widgets.release_older"),
988 release_of: texts.get("widgets.release_of"),
989 diagnostics: texts.get("widgets.diagnostics"),
990 diagnostics_test: texts.get("widgets.diagnostics_test"),
991 diagnostics_testing: texts.get("widgets.diagnostics_testing"),
992 diagnostics_testing_detail: texts.get("widgets.diagnostics_testing_detail"),
993 diagnostics_test_good: texts.get("widgets.diagnostics_test_good"),
994 diagnostics_test_fair: texts.get("widgets.diagnostics_test_fair"),
995 diagnostics_test_poor: texts.get("widgets.diagnostics_test_poor"),
996 diagnostics_test_fps: texts.get("widgets.diagnostics_test_fps"),
997 diagnostics_test_cause_none: texts.get("widgets.diagnostics_test_cause_none"),
998 diagnostics_timeline: texts.get("widgets.diagnostics_timeline"),
999 diagnostics_timeline_detail: texts.get("widgets.diagnostics_timeline_detail"),
1000 diagnostics_why: texts.get("widgets.diagnostics_why"),
1001 diagnostics_why_none: texts.get("widgets.diagnostics_why_none"),
1002 diagnostics_causes: texts.array("widgets.diagnostics_causes"),
1003 diagnostics_views: texts.get("widgets.diagnostics_views"),
1004 diagnostics_batches: texts.get("widgets.diagnostics_batches"),
1005 diagnostics_memory: texts.get("widgets.diagnostics_memory"),
1006 diagnostics_copy_trace: texts.get("widgets.diagnostics_copy_trace"),
1007 diagnostics_test_cause_gpu: texts.get("widgets.diagnostics_test_cause_gpu"),
1008 diagnostics_test_cause_interface: texts.get("widgets.diagnostics_test_cause_interface"),
1009 diagnostics_software: texts.get("widgets.diagnostics_software"),
1010 diagnostics_software_detail: texts.get("widgets.diagnostics_software_detail"),
1011 diagnostics_unoptimized: texts.get("widgets.diagnostics_unoptimized"),
1012 diagnostics_unoptimized_detail: texts.get("widgets.diagnostics_unoptimized_detail"),
1013 diagnostics_hidden: texts.get("widgets.diagnostics_hidden"),
1014 diagnostics_no_gpu: texts.get("widgets.diagnostics_no_gpu"),
1015 diagnostics_frame: texts.get("widgets.diagnostics_frame"),
1016 diagnostics_update: texts.get("widgets.diagnostics_update"),
1017 diagnostics_acquire: texts.get("widgets.diagnostics_acquire"),
1018 diagnostics_render: texts.get("widgets.diagnostics_render"),
1019 diagnostics_report_bug: texts.get("widgets.diagnostics_report_bug"),
1020 diagnostics_report_shares: texts.get("widgets.diagnostics_report_shares"),
1021 diagnostics_report_shares_detail: texts.get("widgets.diagnostics_report_shares_detail"),
1022 diagnostics_report_failed: texts.get("widgets.diagnostics_report_failed"),
1023 diagnostics_report_failed_detail: texts.get("widgets.diagnostics_report_failed_detail"),
1024 diagnostics_report_questions: texts.get("widgets.diagnostics_report_questions"),
1025 diagnostics_report_truncated: texts.get("widgets.diagnostics_report_truncated"),
1026 previous_month: texts.get("widgets.previous_month"),
1027 next_month: texts.get("widgets.next_month"),
1028 today: texts.get("widgets.today"),
1029 weekdays: texts.array("widgets.weekdays"),
1030 months: texts.array("widgets.months"),
1031 month_year: texts.get("widgets.month_year"),
1032 short_date: texts.get("widgets.short_date"),
1033 form_errors: texts.get("widgets.form_errors"),
1034 clear: texts.get("widgets.clear"),
1035 filter_all: texts.get("widgets.filter_all"),
1036 filter_any: texts.get("widgets.filter_any"),
1037 filter_match: texts.get("widgets.filter_match"),
1038 filter_add_condition: texts.get("widgets.filter_add_condition"),
1039 filter_add_group: texts.get("widgets.filter_add_group"),
1040 filter_remove: texts.get("widgets.filter_remove"),
1041 filter_field: texts.get("widgets.filter_field"),
1042 filter_comparison: texts.get("widgets.filter_comparison"),
1043 filter_value: texts.get("widgets.filter_value"),
1044 filter_expression: texts.get("widgets.filter_expression"),
1045 filter_yes: texts.get("widgets.filter_yes"),
1046 filter_no: texts.get("widgets.filter_no"),
1047 filter_equal: texts.get("widgets.filter_equal"),
1048 filter_not_equal: texts.get("widgets.filter_not_equal"),
1049 filter_greater: texts.get("widgets.filter_greater"),
1050 filter_greater_or_equal: texts.get("widgets.filter_greater_or_equal"),
1051 filter_less: texts.get("widgets.filter_less"),
1052 filter_less_or_equal: texts.get("widgets.filter_less_or_equal"),
1053 filter_contains: texts.get("widgets.filter_contains"),
1054 filter_starts_with: texts.get("widgets.filter_starts_with"),
1055 filter_is_empty: texts.get("widgets.filter_is_empty"),
1056 filter_is_not_empty: texts.get("widgets.filter_is_not_empty"),
1057 filter_any_of: texts.get("widgets.filter_any_of"),
1058 filter_none_of: texts.get("widgets.filter_none_of"),
1059 ribbon: texts.get("widgets.ribbon"),
1060 ribbon_search: texts.get("widgets.ribbon_search"),
1061 ribbon_pin: texts.get("widgets.ribbon_pin"),
1062 ribbon_collapse: texts.get("widgets.ribbon_collapse"),
1063 carousel_previous: texts.get("widgets.carousel_previous"),
1064 carousel_next: texts.get("widgets.carousel_next"),
1065 carousel_slide: texts.get("widgets.carousel_slide"),
1066 verification_code: texts.get("widgets.verification_code"),
1067 cancel: texts.get("widgets.cancel"),
1068 confirm_by_typing: texts.get("widgets.confirm_by_typing"),
1069 more_commands: texts.get("widgets.more_commands"),
1070 decimal_separator: texts.char("format.decimal", '.'),
1071 group_separator: texts.char("format.thousands", ','),
1072 pick_time: texts.get("widgets.pick_time"),
1073 step_up: texts.get("widgets.step_up"),
1074 step_down: texts.get("widgets.step_down"),
1075 calendar_more: texts.get("widgets.calendar_more"),
1076 scheduler_resources: texts.get("widgets.scheduler_resources"),
1077 zoom_in: texts.get("widgets.zoom_in"),
1078 zoom_out: texts.get("widgets.zoom_out"),
1079 histogram: texts.get("widgets.histogram"),
1080 histogram_clipped_low: texts.get("widgets.histogram_clipped_low"),
1081 histogram_clipped_high: texts.get("widgets.histogram_clipped_high"),
1082 ruler: texts.get("widgets.ruler"),
1083 color_wheel: texts.get("widgets.color_wheel"),
1084 color_saturation: texts.get("widgets.color_saturation"),
1085 curve_editor: texts.get("widgets.curve_editor"),
1086 curve_point: texts.get("widgets.curve_point"),
1087 curve_points: texts.get("widgets.curve_points"),
1088 curve_input: texts.get("widgets.curve_input"),
1089 curve_output: texts.get("widgets.curve_output"),
1090 zoom: texts.get("widgets.zoom"),
1091 zoom_fit: texts.get("widgets.zoom_fit"),
1092 zoom_actual: texts.get("widgets.zoom_actual"),
1093 zoom_view: texts.get("widgets.zoom_view"),
1094 minimap: texts.get("widgets.minimap"),
1095 rubber_band: texts.get("widgets.rubber_band"),
1096 marquee: texts.get("widgets.marquee"),
1097 transform: texts.get("widgets.transform"),
1098 crop: texts.get("widgets.crop"),
1099 protractor: texts.get("widgets.protractor"),
1100 eyedropper: texts.get("widgets.eyedropper"),
1101 eyedropper_hint: texts.get("widgets.eyedropper_hint"),
1102 eyedropper_area: texts.get("widgets.eyedropper_area"),
1103 compare: texts.get("widgets.compare"),
1104 compare_first: texts.get("widgets.compare_first"),
1105 compare_second: texts.get("widgets.compare_second"),
1106 lightbox: texts.get("widgets.lightbox"),
1107 lightbox_previous: texts.get("widgets.lightbox_previous"),
1108 lightbox_next: texts.get("widgets.lightbox_next"),
1109 lightbox_counter: texts.get("widgets.lightbox_counter"),
1110 recurrence_name: texts.get("widgets.recurrence_name"),
1111 recurrence_frequencies: texts.array("widgets.recurrence_frequencies"),
1112 recurrence_every: texts.get("widgets.recurrence_every"),
1113 recurrence_units: texts.pairs("widgets.recurrence_units"),
1114 recurrence_each: texts.array("widgets.recurrence_each"),
1115 recurrence_ends_name: texts.get("widgets.recurrence_ends_name"),
1116 recurrence_ends: texts.array("widgets.recurrence_ends"),
1117 recurrence_times: texts.get("widgets.recurrence_times"),
1118 recurrence_until: texts.get("widgets.recurrence_until"),
1119 recurrence_next: texts.get("widgets.recurrence_next"),
1120 grid_drag_hint: texts.get("widgets.grid_drag_hint"),
1121 grid_grouped_by: texts.get("widgets.grid_grouped_by"),
1122 grid_remove_group: texts.get("widgets.grid_remove_group"),
1123 grid_expand_all: texts.get("widgets.grid_expand_all"),
1124 grid_collapse_all: texts.get("widgets.grid_collapse_all"),
1125 grid_sort_ascending: texts.get("widgets.grid_sort_ascending"),
1126 grid_sort_descending: texts.get("widgets.grid_sort_descending"),
1127 grid_clear_sort: texts.get("widgets.grid_clear_sort"),
1128 grid_group_by_column: texts.get("widgets.grid_group_by_column"),
1129 grid_ungroup_column: texts.get("widgets.grid_ungroup_column"),
1130 grid_pin_column: texts.get("widgets.grid_pin_column"),
1131 grid_unpin_column: texts.get("widgets.grid_unpin_column"),
1132 grid_hide_column: texts.get("widgets.grid_hide_column"),
1133 grid_fit_column: texts.get("widgets.grid_fit_column"),
1134 grid_show_panel: texts.get("widgets.grid_show_panel"),
1135 grid_hide_panel: texts.get("widgets.grid_hide_panel"),
1136 grid_column_menu: texts.get("widgets.grid_column_menu"),
1137 grid_filter_values: texts.get("widgets.grid_filter_values"),
1138 grid_clear_filter: texts.get("widgets.grid_clear_filter"),
1139 expression_text: texts.get("widgets.expression_text"),
1140 expression_search: texts.get("widgets.expression_search"),
1141 expression_insert: texts.get("widgets.expression_insert"),
1142 expression_valid: texts.get("widgets.expression_valid"),
1143 expression_error_at: texts.get("widgets.expression_error_at"),
1144 expression_unknown: texts.get("widgets.expression_unknown"),
1145 expression_no_match: texts.get("widgets.expression_no_match"),
1146 expression_groups: texts.array("widgets.expression_groups"),
1147 expression_operators: texts.pair_list("widgets.expression_operators"),
1148 expression_constants: texts.pair_list("widgets.expression_constants"),
1149 grid_filter_label: texts.get("widgets.grid_filter_label"),
1150 grid_edit_filter: texts.get("widgets.grid_edit_filter"),
1151 grid_all_values: texts.get("widgets.grid_all_values"),
1152 grid_scenario: texts.get("widgets.grid_scenario"),
1153 grid_scenario_save: texts.get("widgets.grid_scenario_save"),
1154 grid_scenario_update: texts.get("widgets.grid_scenario_update"),
1155 grid_scenario_delete: texts.get("widgets.grid_scenario_delete"),
1156 grid_scenario_original: texts.get("widgets.grid_scenario_original"),
1157 grid_scenario_name: texts.get("widgets.grid_scenario_name"),
1158 grid_save: texts.get("widgets.grid_save"),
1159 grid_rows_per_page: texts.get("widgets.grid_rows_per_page"),
1160 grid_try_again: texts.get("widgets.grid_try_again"),
1161 grid_page: texts.get("widgets.grid_page"),
1162 grid_previous: texts.get("widgets.grid_previous"),
1163 grid_next: texts.get("widgets.grid_next"),
1164 grid_edit_summary: texts.get("widgets.grid_edit_summary"),
1165 grid_summary_of: texts.get("widgets.grid_summary_of"),
1166 grid_summary_none: texts.get("widgets.grid_summary_none"),
1167 grid_summary_formula: texts.get("widgets.grid_summary_formula"),
1168 grid_formula_hint: texts.get("widgets.grid_formula_hint"),
1169 grid_formula_result: texts.get("widgets.grid_formula_result"),
1170 grid_formula_error: texts.get("widgets.grid_formula_error"),
1171 grid_formula_columns: texts.get("widgets.grid_formula_columns"),
1172 grid_formula_functions: texts.get("widgets.grid_formula_functions"),
1173 grid_apply: texts.get("widgets.grid_apply"),
1174 grid_search: texts.get("widgets.grid_search"),
1175 grid_group: texts.get("widgets.grid_group"),
1176 grid_clear_grouping: texts.get("widgets.grid_clear_grouping"),
1177 grid_columns: texts.get("widgets.grid_columns"),
1178 grid_reset: texts.get("widgets.grid_reset"),
1179 grid_export: texts.get("widgets.grid_export"),
1180 grid_export_file: texts.get("widgets.grid_export_file"),
1181 grid_add_row: texts.get("widgets.grid_add_row"),
1182 grid_delete_rows: texts.get("widgets.grid_delete_rows"),
1183 grid_no_rows: texts.get("widgets.grid_no_rows"),
1184 grid_name: texts.get("widgets.grid_name"),
1185 grid_select_row: texts.get("widgets.grid_select_row"),
1186 grid_sorted_ascending: texts.get("widgets.grid_sorted_ascending"),
1187 grid_sorted_descending: texts.get("widgets.grid_sorted_descending"),
1188 grid_filter_hint: texts.get("widgets.grid_filter_hint"),
1189 grid_number_filter_hint: texts.get("widgets.grid_number_filter_hint"),
1190 grid_filter_column: texts.get("widgets.grid_filter_column"),
1191 grid_empty: texts.get("widgets.grid_empty"),
1192 grid_of: texts.get("widgets.grid_of"),
1193 grid_rows: texts.get("widgets.grid_rows"),
1194 grid_selected: texts.get("widgets.grid_selected"),
1195 rating: texts.get("widgets.rating"),
1196 rating_value: texts.get("widgets.rating_value"),
1197 yesterday: texts.get("widgets.yesterday"),
1198 shortcut_sheet: texts.get("widgets.shortcut_sheet"),
1199 favorite: texts.get("widgets.favorite"),
1200 swatches: texts.get("widgets.swatches"),
1201 anchor_point: texts.get("widgets.anchor_point"),
1202 anchor_names: texts.array("widgets.anchor_names"),
1203 color_foreground: texts.get("widgets.color_foreground"),
1204 color_background: texts.get("widgets.color_background"),
1205 color_swap: texts.get("widgets.color_swap"),
1206 color_reset: texts.get("widgets.color_reset"),
1207 grid_summaries: texts.array("widgets.grid_summaries"),
1208 playground_run: texts.get("widgets.playground_run"),
1209 playground_restore: texts.get("widgets.playground_restore"),
1210 playground_example: texts.get("widgets.playground_example"),
1211 playground_code: texts.get("widgets.playground_code"),
1212 playground_result: texts.get("widgets.playground_result"),
1213 playground_last_good: texts.get("widgets.playground_last_good"),
1214 playground_line: texts.get("widgets.playground_line"),
1215 playground_column: texts.get("widgets.playground_column"),
1216 playground_download: texts.get("widgets.playground_download"),
1217 playground_output: texts.get("widgets.playground_output"),
1218 playground_console: texts.get("widgets.playground_console"),
1219 playground_problems: texts.get("widgets.playground_problems"),
1220 playground_no_problems: texts.get("widgets.playground_no_problems"),
1221 playground_nothing_printed: texts.get("widgets.playground_nothing_printed"),
1222 playground_clear_output: texts.get("widgets.playground_clear_output"),
1223 playground_hide_output: texts.get("widgets.playground_hide_output"),
1224 playground_show_output: texts.get("widgets.playground_show_output"),
1225 playground_more: texts.get("widgets.playground_more"),
1226 playground_full_screen: texts.get("widgets.playground_full_screen"),
1227 playground_exit_full_screen: texts.get("widgets.playground_exit_full_screen"),
1228 }
1229 }
1230
1231 pub fn pt_br() -> Self {
1233 Self::from_texts(&Texts::new(Language::BrazilianPortuguese))
1234 }
1235
1236 pub fn dock_place(&self, side: crate::DockSide) -> &str {
1238 match side {
1239 crate::DockSide::Left => &self.dock_left,
1240 crate::DockSide::Right => &self.dock_right,
1241 crate::DockSide::Bottom => &self.dock_bottom,
1242 _ => &self.dock_center,
1243 }
1244 }
1245
1246 fn dock_place_lower(&self, side: crate::DockSide) -> String {
1248 self.dock_place(side).to_lowercase()
1249 }
1250
1251 pub fn dock_with_name(&self, title: &str) -> String {
1253 self.dock_with.replace("{title}", title)
1254 }
1255
1256 pub fn dock_close_name(&self, title: &str) -> String {
1258 self.dock_close_panel.replace("{title}", title)
1259 }
1260
1261 pub fn dock_options_name(&self, title: &str) -> String {
1263 self.dock_options.replace("{title}", title)
1264 }
1265
1266 pub fn dock_hide_name(&self, side: crate::DockSide) -> String {
1268 self.dock_hide.replace("{place}", &self.dock_place_lower(side))
1269 }
1270
1271 pub fn dock_show_name(&self, side: crate::DockSide) -> String {
1273 self.dock_show.replace("{place}", &self.dock_place_lower(side))
1274 }
1275
1276 pub fn dock_resize_name(&self, side: crate::DockSide) -> String {
1278 self.dock_resize.replace("{place}", &self.dock_place_lower(side))
1279 }
1280
1281 pub fn dock_resize_between(&self, first: &str, second: &str) -> String {
1283 self.dock_resize_pair.replace("{first}", first).replace("{second}", second)
1284 }
1285
1286 pub fn dock_moved_to(&self, side: crate::DockSide) -> String {
1288 self.dock_moved.replace("{place}", &self.dock_place_lower(side))
1289 }
1290
1291 pub fn dock_closed_name(&self, title: &str) -> String {
1293 self.dock_closed.replace("{title}", title)
1294 }
1295
1296 pub fn moved_to_position(&self, position: usize, total: usize) -> String {
1298 self.moved_to.replace("{position}", &position.to_string()).replace("{total}", &total.to_string())
1299 }
1300
1301 pub fn page_name(&self, number: usize, total: usize) -> String {
1303 format!("{} {number}{}{total}", self.page_word, self.page_of)
1304 }
1305
1306 pub fn short_date(&self, date: Date) -> String {
1308 let month = &self.months[usize::from(date.month().clamp(1, 12)) - 1];
1309 format_with(&self.short_date, |index, out| {
1310 match index {
1311 0 => write!(out, "{:02}", date.day()),
1312 1 => write!(out, "{:02}", date.month()),
1313 2 => write!(out, "{:04}", date.year()),
1314 3 => write!(out, "{}", date.day()),
1315 4 => {
1316 out.extend(month.chars().take(3));
1317 Ok(())
1318 }
1319 _ => return false,
1320 }
1321 .is_ok()
1322 })
1323 }
1324
1325 pub fn tag_add(&self, typed: &str) -> String {
1327 ravenrs_app_i18n::format(&self.tag_add, &[typed])
1328 }
1329
1330 pub fn wizard_progress(&self, step: usize, count: usize) -> String {
1332 two_numbers(&self.wizard_progress, step, count)
1333 }
1334
1335 pub fn theme_changed(&self, count: usize) -> String {
1337 two_numbers(&self.theme_changed[count.min(2)], count, 0)
1338 }
1339
1340 pub fn theme_contrast(&self, ratio: f32, ground: &str) -> String {
1342 format_with(&self.theme_contrast, |index, out| match index {
1343 0 => {
1344 let at = out.len();
1345 let written = write!(out, "{ratio:.1}").is_ok();
1346 if let Some(point) = out[at..].find('.') {
1347 let mut separator = [0; 4];
1348 out.replace_range(
1349 at + point..=at + point,
1350 self.decimal_separator.encode_utf8(&mut separator),
1351 );
1352 }
1353 written
1354 }
1355 1 => {
1356 out.push_str(ground);
1357 true
1358 }
1359 _ => false,
1360 })
1361 }
1362
1363 pub fn lightbox_counter(&self, at: usize, of: usize) -> String {
1365 two_numbers(&self.lightbox_counter, at, of)
1366 }
1367
1368 pub fn rating_value(&self, score: u32, max: u32) -> String {
1370 two_numbers(&self.rating_value, score as usize, max as usize)
1371 }
1372
1373 pub fn month_title(&self, date: Date) -> String {
1375 let month = &self.months[usize::from(date.month().clamp(1, 12)) - 1];
1376 format!("{month}{}{}", self.month_year, date.year())
1377 }
1378
1379 pub fn long_date(&self, date: Date) -> String {
1381 format!("{} {}", date.day(), self.month_title(date))
1382 }
1383
1384 pub fn recurrence_unit(&self, frequency: Frequency, count: u32) -> &str {
1386 let unit = match frequency {
1387 Frequency::Daily => &self.recurrence_units[0],
1388 Frequency::Weekly => &self.recurrence_units[1],
1389 Frequency::Yearly => &self.recurrence_units[3],
1390 _ => &self.recurrence_units[2],
1391 };
1392 if count > 1 { &unit.1 } else { &unit.0 }
1393 }
1394
1395 pub fn recurrence_summary(&self, rule: &RecurrenceRule, start: Date) -> String {
1397 let how = match (rule.frequency, rule.interval.max(1)) {
1398 (Frequency::Daily, 1) => self.recurrence_each[0].clone(),
1399 (Frequency::Weekly, 1) => self.recurrence_each[1].clone(),
1400 (Frequency::Monthly, 1) => self.recurrence_each[2].clone(),
1401 (Frequency::Yearly, 1) => self.recurrence_each[3].clone(),
1402 (Frequency::Daily | Frequency::Weekly | Frequency::Monthly | Frequency::Yearly, n) => {
1403 format!("{} {n} {}", self.recurrence_every, self.recurrence_unit(rule.frequency, n))
1404 }
1405 _ => self.recurrence_frequencies[0].clone(),
1406 };
1407 let until = match rule.end {
1408 RecurrenceEnd::Until(day) => format!(" {} {}", self.recurrence_until, self.short_date(day)),
1409 RecurrenceEnd::After(count) => format!(", {count} {}", self.recurrence_times),
1410 _ => String::new(),
1411 };
1412 let next: Vec<String> = rule.days_from(start).take(3).map(|day| self.short_date(day)).collect();
1413 format!("{how}{until}. {}: {}", self.recurrence_next, next.join(", "))
1414 }
1415
1416 pub fn summary(&self, summary: Summary) -> &str {
1418 let index = match summary {
1419 Summary::Count => 0,
1420 Summary::Sum => 1,
1421 Summary::Average => 2,
1422 Summary::Min => 3,
1423 _ => 4,
1424 };
1425 &self.grid_summaries[index]
1426 }
1427}
1428
1429#[derive(Debug)]
1441pub struct Localized<V> {
1442 labels: std::rc::Rc<Labels>,
1443 content: V,
1444}
1445
1446#[cfg_attr(feature = "live", ravenrs_live::expose)]
1447impl<V: View> Localized<V> {
1448 pub fn new(labels: Labels, content: V) -> Self {
1450 Self { labels: std::rc::Rc::new(labels), content }
1451 }
1452}
1453
1454impl<V: View> View for Localized<V> {
1455 fn build(&self, cx: &mut BuildCx<'_>) -> NodeId {
1456 let outer = cx.replace_labels(self.labels.clone());
1457 let node = cx.child(&self.content);
1458 cx.replace_labels(outer);
1459 node
1460 }
1461}
1462
1463fn two_numbers(template: &str, first: usize, second: usize) -> String {
1465 format_with(template, |index, out| match index {
1466 0 => write!(out, "{first}").is_ok(),
1467 1 => write!(out, "{second}").is_ok(),
1468 _ => false,
1469 })
1470}