1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/// Groups together labels from different elements of the [`DockArea`](crate::DockArea).
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Translations {
/// Text overrides for buttons in tab context menus.
pub tab_context_menu: TabContextMenuTranslations,
/// Text overrides for buttons in windows.
pub leaf: LeafTranslations,
}
/// Specifies text in buttons displayed in the context menu displayed upon right-clicking on a tab.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct TabContextMenuTranslations {
/// Button that closes the tab.
pub close_button: String,
/// Button that undocks the tab into a new window.
pub eject_button: String,
}
/// Specifies text displayed in the primary buttons on a tab bar.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct LeafTranslations {
/// Message in the tooltip shown while hovering over a grayed out X button of a leaf
/// containing non-closable tabs.
pub close_button_disabled_tooltip: String,
/// Button that closes the entire window.
pub close_all_button: String,
/// Message in the tooltip shown while hovering over an X button of a window.
/// Used when the secondary buttons are accessible from the context menu.
pub close_all_button_menu_hint: String,
/// Message in the tooltip shown while hovering over an X button of a window.
/// Used when the secondary buttons are accessible using modifiers.
pub close_all_button_modifier_hint: String,
/// Message in the tooltip shown while hovering over an X button of a window.
/// Used when the secondary buttons are accessible using modifiers and from the context menu.
pub close_all_button_modifier_menu_hint: String,
/// Message in the tooltip shown while hovering over a grayed out close window button of a window
/// containing non-closable tabs.
pub close_all_button_disabled_tooltip: String,
/// Button that minimizes the window.
pub minimize_button: String,
/// Message in the tooltip shown while hovering over a collapse button of a leaf.
/// Used when the secondary buttons are accessible from the context menu.
pub minimize_button_menu_hint: String,
/// Message in the tooltip shown while hovering over a collapse button of a leaf.
/// Used when the secondary buttons are accessible using modifiers.
pub minimize_button_modifier_hint: String,
/// Message in the tooltip shown while hovering over a collapse button of a leaf.
/// Used when the secondary buttons are accessible using modifiers and from the context menu.
pub minimize_button_modifier_menu_hint: String,
}
impl Translations {
/// Default English translations.
pub fn english() -> Self {
Self {
tab_context_menu: TabContextMenuTranslations::english(),
leaf: LeafTranslations::english(),
}
}
}
impl TabContextMenuTranslations {
/// Default English translations.
pub fn english() -> Self {
Self {
close_button: String::from("Close"),
eject_button: String::from("Eject"),
}
}
}
impl LeafTranslations {
/// Default English translations.
pub fn english() -> Self {
Self {
close_button_disabled_tooltip: String::from("This leaf contains non-closable tabs."),
close_all_button: String::from("Close window"),
close_all_button_menu_hint: String::from("Right click to close this window."),
close_all_button_modifier_hint: String::from(
"Press modifier keys (Shift by default) to close this window.",
),
close_all_button_modifier_menu_hint: String::from(
"Press modifier keys (Shift by default) or right click to close this window.",
),
close_all_button_disabled_tooltip: String::from(
"This window contains non-closable tabs.",
),
minimize_button: String::from("Minimize window"),
minimize_button_menu_hint: String::from("Right click to minimize this window."),
minimize_button_modifier_hint: String::from(
"Press modifier keys (Shift by default) to minimize this window.",
),
minimize_button_modifier_menu_hint: String::from(
"Press modifier keys (Shift by default) or right click to minimize this window.",
),
}
}
}