Skip to main content

egui_pop_viewport/
strings.rs

1//! The strings the viewport shows, by key with English fallbacks,
2//! translated through the provider installed with
3//! `egui_pop_core::strings::install` (see that module for the key and
4//! placeholder conventions).
5
6use egui_pop_core::strings::StrKey;
7
8/// The viewport's accessible name, unless the application gives one.
9pub const VIEWPORT: StrKey = StrKey::new("egui-pop-viewport-label", "Image viewport");
10/// The histogram's accessible name, unless the application gives one.
11pub const HISTOGRAM: StrKey = StrKey::new("egui-pop-viewport-histogram-label", "Histogram");
12/// The histogram's accessible value: its channels and bin count.
13pub const HISTOGRAM_VALUE: StrKey = StrKey::new(
14    "egui-pop-viewport-histogram-value",
15    "{ $channels } ({ $bins } bins)",
16);
17/// As [`HISTOGRAM_VALUE`], on a logarithmic scale.
18pub const HISTOGRAM_VALUE_LOG: StrKey = StrKey::new(
19    "egui-pop-viewport-histogram-value-log",
20    "{ $channels } ({ $bins } bins, logarithmic)",
21);
22
23/// Added to the histogram's value when shadows are clipped.
24pub const HISTOGRAM_CLIPPED_SHADOWS: StrKey = StrKey::new(
25    "egui-pop-viewport-histogram-clipped-shadows",
26    "shadows clipped: { $percent } %",
27);
28/// Added to the histogram's value when highlights are clipped.
29pub const HISTOGRAM_CLIPPED_HIGHLIGHTS: StrKey = StrKey::new(
30    "egui-pop-viewport-histogram-clipped-highlights",
31    "highlights clipped: { $percent } %",
32);
33/// A curve editor's accessible value, no point selected.
34pub const CURVE_VALUE: StrKey = StrKey::new("egui-pop-viewport-curve-value", "{ $points } points");
35/// A curve editor's accessible value, with the selected point.
36pub const CURVE_VALUE_SELECTED: StrKey = StrKey::new(
37    "egui-pop-viewport-curve-value-selected",
38    "point { $point } of { $points }: input { $input } %, output { $output } %",
39);
40/// A curve editor, as the shortcuts editor names it among the widgets'
41/// own gestures.
42pub const CURVE_EDITOR: StrKey = StrKey::new("egui-pop-viewport-curve-editor", "Curve editor");
43/// What a curve editor's secondary click does.
44pub const CURVE_SECONDARY_CLICK: StrKey = StrKey::new(
45    "egui-pop-viewport-curve-secondary-click",
46    "Deletes the point under the pointer",
47);
48/// A colour wheel's accessible value.
49pub const WHEEL_VALUE: StrKey = StrKey::new(
50    "egui-pop-viewport-wheel-value",
51    "hue { $hue }°, chroma { $chroma } %, luminance { $luminance }",
52);
53/// The name of a colour wheel's luminance slider.
54pub const WHEEL_LUMINANCE: StrKey =
55    StrKey::new("egui-pop-viewport-wheel-luminance", "{ $wheel } luminance");
56/// The navigator's accessible name, unless the application gives one.
57pub const NAVIGATOR: StrKey = StrKey::new("egui-pop-viewport-navigator-label", "Navigator");
58/// The navigator's accessible value: the zoom and the centre in view.
59pub const NAVIGATOR_VALUE: StrKey = StrKey::new(
60    "egui-pop-viewport-navigator-value",
61    "zoom { $zoom } %, centre { $x }, { $y }",
62);
63/// The loupe's readout: the values as displayed.
64pub const LOUPE_DISPLAY: StrKey = StrKey::new("egui-pop-viewport-loupe-display", "display");
65/// The loupe's readout: the values the source gave.
66pub const LOUPE_SCENE: StrKey = StrKey::new("egui-pop-viewport-loupe-scene", "scene");
67/// The loupe's readout when there is no value to show.
68pub const LOUPE_NONE: StrKey = StrKey::new("egui-pop-viewport-loupe-none", "no value");
69/// The zoom control's button one ladder step down.
70pub const ZOOM_OUT: StrKey = StrKey::new("egui-pop-viewport-zoom-out", "Zoom out");
71/// The zoom control's button one ladder step up.
72pub const ZOOM_IN: StrKey = StrKey::new("egui-pop-viewport-zoom-in", "Zoom in");
73/// The zoom control's button fitting the image.
74pub const ZOOM_FIT: StrKey = StrKey::new("egui-pop-viewport-zoom-fit", "Fit");
75/// The zoom control's button showing one image pixel per screen pixel.
76pub const ZOOM_ACTUAL: StrKey = StrKey::new("egui-pop-viewport-zoom-actual", "100 %");
77/// A canvas zoom control's menu item framing the selection.
78pub const ZOOM_FRAME_SELECTION: StrKey = StrKey::new(
79    "egui-pop-viewport-zoom-frame-selection",
80    "Frame the selection",
81);
82/// A canvas zoom control's percentage, a menu of zoom levels.
83pub const ZOOM_LEVEL: StrKey = StrKey::new("egui-pop-viewport-zoom-level", "Zoom level");
84
85/// A node graph's accessible name, unless the application gives one.
86pub const GRAPH: StrKey = StrKey::new("egui-pop-viewport-graph-label", "Node graph");
87/// A node graph's accessible value.
88pub const GRAPH_VALUE: StrKey = StrKey::new(
89    "egui-pop-viewport-graph-value",
90    "{ $nodes } nodes, { $wires } wires, { $level }",
91);
92/// The overview level, in the graph's value.
93pub const GRAPH_LEVEL_OVERVIEW: StrKey =
94    StrKey::new("egui-pop-viewport-graph-level-overview", "overview");
95/// The ports level, in the graph's value.
96pub const GRAPH_LEVEL_PORTS: StrKey = StrKey::new("egui-pop-viewport-graph-level-ports", "ports");
97/// The detail level, in the graph's value.
98pub const GRAPH_LEVEL_DETAIL: StrKey =
99    StrKey::new("egui-pop-viewport-graph-level-detail", "detail");
100/// What a screen reader calls a node.
101pub const GRAPH_ROLE_NODE: StrKey = StrKey::new("egui-pop-viewport-graph-role-node", "node");
102/// What a screen reader calls a group folded into a stack.
103pub const GRAPH_ROLE_STACK: StrKey = StrKey::new("egui-pop-viewport-graph-role-stack", "stack");
104/// What a screen reader calls an input port.
105pub const GRAPH_ROLE_INPUT: StrKey =
106    StrKey::new("egui-pop-viewport-graph-role-input", "input port");
107/// What a screen reader calls an output port.
108pub const GRAPH_ROLE_OUTPUT: StrKey =
109    StrKey::new("egui-pop-viewport-graph-role-output", "output port");
110/// A node's accessible value.
111pub const GRAPH_NODE_VALUE: StrKey = StrKey::new(
112    "egui-pop-viewport-graph-node-value",
113    "{ $inputs } inputs, { $outputs } outputs, { $wires } wires",
114);
115/// An input port's accessible name.
116pub const GRAPH_PORT_INPUT: StrKey = StrKey::new(
117    "egui-pop-viewport-graph-port-input",
118    "{ $node }, input { $port }",
119);
120/// An output port's accessible name.
121pub const GRAPH_PORT_OUTPUT: StrKey = StrKey::new(
122    "egui-pop-viewport-graph-port-output",
123    "{ $node }, output { $port }",
124);
125/// A port's accessible value: its type and wires.
126pub const GRAPH_PORT_VALUE: StrKey = StrKey::new(
127    "egui-pop-viewport-graph-port-value",
128    "{ $type }, { $wires } wires",
129);
130/// The button collapsing a node to its title.
131pub const GRAPH_COLLAPSE: StrKey =
132    StrKey::new("egui-pop-viewport-graph-collapse", "Collapse { $node }");
133/// The button expanding a collapsed node.
134pub const GRAPH_EXPAND: StrKey = StrKey::new("egui-pop-viewport-graph-expand", "Expand { $node }");
135/// A group's title, folding it into a stack.
136pub const GRAPH_FOLD: StrKey = StrKey::new("egui-pop-viewport-graph-fold", "Fold { $group }");
137/// A stack, unfolding its group.
138pub const GRAPH_UNFOLD: StrKey = StrKey::new(
139    "egui-pop-viewport-graph-unfold",
140    "Unfold { $group } ({ $count } nodes)",
141);
142/// Announced when a wire is begun from a port.
143pub const GRAPH_WIRE_STARTED: StrKey = StrKey::new(
144    "egui-pop-viewport-graph-wire-started",
145    "Wire from { $port }: choose a port",
146);
147/// Announced when a wire is made.
148pub const GRAPH_CONNECTED: StrKey = StrKey::new(
149    "egui-pop-viewport-graph-connected",
150    "{ $from } connected to { $to }",
151);
152/// Announced when a wire is refused.
153pub const GRAPH_REFUSED: StrKey = StrKey::new(
154    "egui-pop-viewport-graph-refused",
155    "{ $to } refuses { $from }: { $reason }",
156);
157/// Why a wire is refused: the ports' types.
158pub const GRAPH_TYPES_DIFFER: StrKey = StrKey::new(
159    "egui-pop-viewport-graph-types-differ",
160    "the types differ ({ $from }, { $to })",
161);
162/// Why a wire is refused: one node at both ends.
163pub const GRAPH_SAME_NODE: StrKey = StrKey::new(
164    "egui-pop-viewport-graph-same-node",
165    "a node cannot feed itself",
166);
167/// Why a wire is refused: two ports of one side.
168pub const GRAPH_SAME_SIDE: StrKey = StrKey::new(
169    "egui-pop-viewport-graph-same-side",
170    "two inputs or two outputs",
171);
172/// Why a wire is not made again.
173pub const GRAPH_EXISTS: StrKey = StrKey::new(
174    "egui-pop-viewport-graph-exists",
175    "the wire is already there",
176);
177/// The canvas menu's title.
178pub const GRAPH_ADD_NODE: StrKey = StrKey::new("egui-pop-viewport-graph-add-node", "Add a node");
179/// A node's menu: duplicate the selection.
180pub const GRAPH_DUPLICATE: StrKey = StrKey::new("egui-pop-viewport-graph-duplicate", "Duplicate");
181/// A node's menu: delete the selection.
182pub const GRAPH_DELETE: StrKey = StrKey::new("egui-pop-viewport-graph-delete", "Delete");
183/// A port's menu: remove its wires.
184pub const GRAPH_DISCONNECT: StrKey =
185    StrKey::new("egui-pop-viewport-graph-disconnect", "Disconnect");
186/// A wire's accessible role description.
187pub const GRAPH_ROLE_WIRE: StrKey = StrKey::new("egui-pop-viewport-graph-role-wire", "wire");
188/// A wire's accessible name: its two ports' names.
189pub const GRAPH_WIRE_NAME: StrKey =
190    StrKey::new("egui-pop-viewport-graph-wire-name", "{ $from } to { $to }");
191/// A wire's tooltip: its ends, node and port.
192pub const GRAPH_WIRE_TIP: StrKey = StrKey::new(
193    "egui-pop-viewport-graph-wire-tip",
194    "{ $from_node } · { $from_port } to { $to_node } · { $to_port }",
195);
196/// What the keys do on a focused wire (its accessible description).
197pub const GRAPH_WIRE_KEYS: StrKey = StrKey::new(
198    "egui-pop-viewport-graph-wire-keys",
199    "Delete to disconnect, Enter to move its input end, Shift+Enter to move its output end",
200);
201/// What the pointer does on a wire, in the canvas's hint.
202pub const GRAPH_WIRE_HINT: StrKey = StrKey::new(
203    "egui-pop-viewport-graph-wire-hint",
204    "Click: select the wire · Ctrl+click: add it · Drag: move its nearer end · Right-click: its menu",
205);
206/// The one-time hint on a canvas's first use.
207pub const NAV_HINT: StrKey = StrKey::new(
208    "egui-pop-viewport-nav-hint",
209    "Middle-drag, Space+drag or H to pan · Ctrl+wheel to zoom · F to frame",
210);
211/// A canvas zoom control's hand mode button.
212pub const NAV_HAND_BUTTON: StrKey = StrKey::new("egui-pop-viewport-nav-hand-button", "Hand");
213/// The indicator shown while hand mode is on.
214pub const NAV_HAND: StrKey = StrKey::new(
215    "egui-pop-viewport-nav-hand",
216    "Hand: drag to pan (H to leave)",
217);
218/// Announced when wires are removed.
219pub const GRAPH_DISCONNECTED: StrKey = StrKey::new(
220    "egui-pop-viewport-graph-disconnected",
221    "{ $from } disconnected from { $to }",
222);
223/// Announced when the wires selected change.
224pub const GRAPH_WIRES_SELECTED: StrKey = StrKey::new(
225    "egui-pop-viewport-graph-wires-selected",
226    "{ $count } wires selected",
227);
228/// Announced when a wire's input end is picked up.
229pub const GRAPH_WIRE_INPUT_PICKED: StrKey = StrKey::new(
230    "egui-pop-viewport-graph-wire-input-picked",
231    "Wire from { $from } taken off { $to }: choose an input",
232);
233/// Announced when a wire's output end is picked up.
234pub const GRAPH_WIRE_OUTPUT_PICKED: StrKey = StrKey::new(
235    "egui-pop-viewport-graph-wire-output-picked",
236    "Wire to { $to } taken off { $from }: choose an output",
237);
238/// A wire's menu: select the node it comes from.
239pub const GRAPH_SELECT_SOURCE: StrKey =
240    StrKey::new("egui-pop-viewport-graph-select-source", "Select the source");
241/// A wire's menu: select the node it goes to.
242pub const GRAPH_SELECT_DESTINATION: StrKey = StrKey::new(
243    "egui-pop-viewport-graph-select-destination",
244    "Select the destination",
245);
246/// The graph minimap's accessible name, unless the application gives one.
247pub const GRAPH_MINIMAP: StrKey =
248    StrKey::new("egui-pop-viewport-graph-minimap-label", "Graph overview");
249/// The graph minimap's accessible value.
250pub const GRAPH_MINIMAP_VALUE: StrKey =
251    StrKey::new("egui-pop-viewport-graph-minimap-value", "zoom { $zoom } %");
252
253/// What a pointer gesture does, in a canvas's hint (`Wheel: zoom`).
254pub const HINT_ZOOM: StrKey = StrKey::new("egui-pop-viewport-hint-zoom", "zoom");
255pub const HINT_ZOOM_FREE: StrKey =
256    StrKey::new("egui-pop-viewport-hint-zoom-free", "zoom without stops");
257pub const HINT_PAN: StrKey = StrKey::new("egui-pop-viewport-hint-pan", "pan");
258pub const HINT_PAN_X: StrKey = StrKey::new("egui-pop-viewport-hint-pan-x", "pan sideways");
259pub const HINT_PAN_Y: StrKey = StrKey::new("egui-pop-viewport-hint-pan-y", "pan up and down");
260pub const HINT_ZOOM_CYCLE: StrKey =
261    StrKey::new("egui-pop-viewport-hint-zoom-cycle", "100 %, 200 %, fit");
262pub const HINT_FIT: StrKey = StrKey::new("egui-pop-viewport-hint-fit", "fit");
263pub const HINT_ZOOM_TOGGLE: StrKey =
264    StrKey::new("egui-pop-viewport-hint-zoom-toggle", "fit or 100 %");
265pub const HINT_LEAVE: StrKey = StrKey::new("egui-pop-viewport-hint-leave", "leave");
266
267/// Every string the viewport shows, for catalogues and tests.
268pub const ALL: &[StrKey] = &[
269    HINT_ZOOM,
270    HINT_ZOOM_FREE,
271    HINT_PAN,
272    HINT_PAN_X,
273    HINT_PAN_Y,
274    HINT_ZOOM_CYCLE,
275    HINT_FIT,
276    HINT_ZOOM_TOGGLE,
277    HINT_LEAVE,
278    VIEWPORT,
279    HISTOGRAM,
280    HISTOGRAM_VALUE,
281    HISTOGRAM_VALUE_LOG,
282    HISTOGRAM_CLIPPED_SHADOWS,
283    HISTOGRAM_CLIPPED_HIGHLIGHTS,
284    CURVE_VALUE,
285    CURVE_VALUE_SELECTED,
286    CURVE_EDITOR,
287    CURVE_SECONDARY_CLICK,
288    WHEEL_VALUE,
289    WHEEL_LUMINANCE,
290    NAVIGATOR,
291    NAVIGATOR_VALUE,
292    LOUPE_DISPLAY,
293    LOUPE_SCENE,
294    LOUPE_NONE,
295    ZOOM_OUT,
296    ZOOM_IN,
297    ZOOM_FIT,
298    ZOOM_ACTUAL,
299    ZOOM_FRAME_SELECTION,
300    ZOOM_LEVEL,
301    GRAPH,
302    GRAPH_VALUE,
303    GRAPH_LEVEL_OVERVIEW,
304    GRAPH_LEVEL_PORTS,
305    GRAPH_LEVEL_DETAIL,
306    GRAPH_ROLE_NODE,
307    GRAPH_ROLE_STACK,
308    GRAPH_ROLE_INPUT,
309    GRAPH_ROLE_OUTPUT,
310    GRAPH_NODE_VALUE,
311    GRAPH_PORT_INPUT,
312    GRAPH_PORT_OUTPUT,
313    GRAPH_PORT_VALUE,
314    GRAPH_COLLAPSE,
315    GRAPH_EXPAND,
316    GRAPH_FOLD,
317    GRAPH_UNFOLD,
318    GRAPH_WIRE_STARTED,
319    GRAPH_CONNECTED,
320    GRAPH_REFUSED,
321    GRAPH_TYPES_DIFFER,
322    GRAPH_SAME_NODE,
323    GRAPH_SAME_SIDE,
324    GRAPH_EXISTS,
325    GRAPH_ADD_NODE,
326    GRAPH_DUPLICATE,
327    GRAPH_DELETE,
328    GRAPH_DISCONNECT,
329    GRAPH_ROLE_WIRE,
330    GRAPH_WIRE_NAME,
331    GRAPH_WIRE_TIP,
332    GRAPH_WIRE_KEYS,
333    GRAPH_WIRE_HINT,
334    GRAPH_DISCONNECTED,
335    GRAPH_WIRES_SELECTED,
336    GRAPH_WIRE_INPUT_PICKED,
337    GRAPH_WIRE_OUTPUT_PICKED,
338    GRAPH_SELECT_SOURCE,
339    GRAPH_SELECT_DESTINATION,
340    GRAPH_MINIMAP,
341    GRAPH_MINIMAP_VALUE,
342    NAV_HINT,
343    NAV_HAND,
344    NAV_HAND_BUTTON,
345];
346
347#[cfg(test)]
348mod tests {
349    use super::*;
350
351    #[test]
352    fn keys_are_unique_fluent_ids() {
353        let mut seen = std::collections::BTreeSet::new();
354        for k in ALL {
355            assert!(seen.insert(k.key), "`{}` twice", k.key);
356            assert!(k.key.starts_with("egui-pop-"), "{}", k.key);
357            assert!(
358                k.key
359                    .chars()
360                    .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-'),
361                "{}",
362                k.key
363            );
364        }
365    }
366}