Skip to main content

Module strings

Module strings 

Source
Expand description

The strings egui-pop shows (Cancel, Retry, accessibility descriptions, the titles of what plugins declare), by key with English fallbacks. An application installs a Strings provider (the egui-pop-i18n plugin, for instance); without one, the fallbacks are used.

Keys are Fluent message ids, with an optional attribute (egui-pop-retry, command-app-quit.title), so a provider can read them from .ftl catalogues as they are. Placeholders are written as Fluent writes them, { $name }, and filled by tr_args with text kept as given (a folder named “2026” stays “2026”), or by tr_with with typed Args, where a number (Arg::Num) is written as the language writes numbers (“1,234”, “1 234”).

What plugins declare (commands, panels, menus, settings, plugins, the context stack’s frames) is translated through keys derived from its stable id, never from its English, so rewording English keeps the translations:

WhatKey
a command’s title, descriptioncommand-<id>.title, .description
a command’s categorycategory-<english> (categories have no id)
a panel’s titlepanel-<id>.title
a submenu’s labelmenu-<id>.label
a setting’s label, descriptionsetting-<id>.label, .description
one value of a choice settingsetting-<id>-choice-<value>
a plugin’s title (a settings section)plugin-<id>.title
a frame’s title (a crumb, a mode chip)frame-<id>.title

where every id is written with slug (a category’s English in lower case).

use std::sync::Arc;
use egui_pop_core::strings::{self, MapStrings, RETRY};

let ctx = egui::Context::default();
assert_eq!(strings::tr(&ctx, &RETRY), "Retry");
strings::install(&ctx, Arc::new(MapStrings::new("fr").with(RETRY.key, "Réessayer")));
assert_eq!(strings::tr(&ctx, &RETRY), "Réessayer");
assert_eq!(strings::command_title(&ctx, "app.quit", "Quit"), "Quit");

Modules§

kind
The kinds of declarations translated by derived keys.

Structs§

English
No translations: every string is its English fallback.
MapStrings
Translations from a map, for tests and small applications.
PanelCommand
A command derived from a panel (<panel>.focus, <panel>.toggle): its title and description are shared texts with a { $panel } placeholder, filled with the panel’s title in the interface’s language, so a catalogue translates them once for every panel. A translation under the command’s own keys still wins.
StrKey
A string’s key and its English fallback. { $name } placeholders are filled by tr_args.

Enums§

Arg
A value placed in a { $name } placeholder.

Constants§

ALL
Every string egui-pop core shows, for catalogues and tests.
BUSY
A busy indicator without a label of its own.
CANCEL
CLOSE
DIALOG_RESIZE
EXIT_FULLSCREEN
A full screen window’s button in place of maximize.
FAULT_BODY
FAULT_TITLE
FIELD_DISABLED
FIELD_MODIFIED_DEFAULT
FIELD_MODIFIED_SAVED
FIELD_PENDING
FIELD_REQUIRED
A field’s states, as markers and assistive technologies say them.
FIELD_RESET
FOLD_TOGGLE
A tree row’s toggle, named after its row (fold::TreeRow).
HELD_BY
INDICATOR_CHANGED
A value’s marks (indicator::ValueMark).
INDICATOR_DONE
INDICATOR_ERROR
INDICATOR_FAILED
INDICATOR_HELD
INDICATOR_INVALID
INDICATOR_MIXED
INDICATOR_MODIFIED
INDICATOR_MOVED
INDICATOR_NO_COLOR
INDICATOR_OFF
What an indicator means, when the application gives it no name of its own: an LED’s state, a flag, a pip, a swatch.
INDICATOR_ON
INDICATOR_PERCENT
INDICATOR_PINNED
INDICATOR_REQUIRED
INDICATOR_WARNING
INPUT_CHOICES
A decorated input’s dropdown chevron.
INPUT_CLEAR
A decorated input’s clear button.
INPUT_MORE
A split button’s chevron.
LATE_LOADING
A late value’s placeholder, its spinner and its Retry button, as assistive technologies name them.
LATE_RETRY
LATE_UPDATING
LOADING
A skeleton standing in for content that loads.
MAXIMIZE
MINIMIZE
The window frame’s buttons (the close button says CLOSE).
NOTE_COPIED
Said beside a note’s Copy button for a moment after a click.
NOTE_COPY
A note’s Copy button: its name and tooltip.
NOTE_DETAILS
The title of a note’s folded technical details.
NOTE_ERROR
The name and tooltip of an error note’s symbol.
NOTE_INFO
The name and tooltip of an information note’s symbol.
NOTE_SUCCESS
The name and tooltip of a success note’s symbol.
NOTE_WARNING
The name and tooltip of a warning note’s symbol.
NO_VALUE
A bound widget’s tooltip when its path holds no value.
NUMBER_DECREASE
NUMBER_INCREASE
A number input’s arrows, as assistive technologies name them.
NUMBER_NOT_A_NUMBER
Why a number input refused a typed value.
NUMBER_OUT_OF_RANGE
NUMBER_WHOLE
OK
RATING
Rating stars’ accessible name (rating::RatingStars).
RATING_CLEAR
The tooltip and name of the star of the current rating: a click clears it.
RATING_SET
A star’s tooltip and name: what a click on it gives.
RATING_VALUE
A rating as read aloud, and a shown rating’s name: “3 of 5”.
READ_ONLY
RESET
RESTORE
RETRY
SCROLLABLE_CONTENT
SECTION_RESIZE
The boundary between two sections of a stack, named after the one above it (sections::Sections).
SEGMENTED_MORE
A segmented control’s button holding the options that do not fit.
SLIDER_ENTRY
A slider’s typed entry, open over its bar, as assistive technologies name it.
SLIDER_MAXIMUM
SLIDER_MINIMUM
A range slider’s thumbs, as assistive technologies name them.
SLIDER_TYPE_VALUE
A slider’s or a knob’s menu item opening its typed entry.

Traits§

Strings
Gives the text of a key in the current language, if it has one.

Functions§

application
The application’s name set for a context (empty when none was).
category
A command category.
category_key
The key of a command category, derived from its English (categories have no id).
command_description
A command’s description (empty stays empty).
command_title
A command’s title. A title saying { $application } (in English or in its translation) has it filled with the application’s name (set_application).
declared
A declaration’s text in the current language, else its English.
declared_key
The key of a declaration’s text: <kind>-<slug(id)>, then .<attr> when given.
fill
Fills { $name } (and {$name}) placeholders with text.
fill_with
Fills { $name } (and {$name}) placeholders with typed arguments, numbers written plain (Arg::plain).
frame_title
A frame’s title (a place’s crumb, a mode’s chip): frame-<id>.title.
install
Installs a provider for a context.
lookup
The text of any key, with the English to show without a translation (the key itself when fallback is empty).
lookup_args
lookup with text arguments, placed verbatim.
lookup_with
lookup with typed arguments (see tr_with).
menu_label
A submenu’s label.
number
A number in the interface’s language, with exactly decimals digits after the separator (slider values, readouts): Strings::number, else as Rust writes it.
panel_command
The panel a command is derived from, with its shared texts.
panel_commands
The commands derived from panels installed for a context.
panel_title
A panel’s title.
plugin_title
A plugin’s title (the settings form’s section).
provider
The installed provider (English when none is).
provider_id
Which provider is installed, as an identity that changes when another one is installed (None: the built-in English). A cache of translated texts keys on it.
quantity
A number already written followed by its unit, in the interface’s language: Strings::quantity, else with a plain space between them. An empty unit gives the number alone.
set_application
Sets the application’s name for a context: what { $application } says in a command’s title (“About { $application }”). The application does it for each context it is drawn in.
set_panel_commands
Installs the commands derived from panels for a context (see PanelCommand); the application does it for each context it is drawn in.
setting_choice
One value of a choice setting, as shown (the value itself without a translation).
setting_choice_key
The key of one value of a choice setting.
setting_description
A setting’s description (empty stays empty).
setting_label
A setting’s label.
slug
A stable id written as part of a Fluent identifier: ASCII letters, digits and - are kept, every other character becomes - (app.quit gives app-quit). Two ids that differ only by those characters share a key.
tr
The text of a key.
tr_args
The text of a key with its { $name } placeholders filled with text, placed verbatim even when it looks like a number. A count or a size to write as the language writes numbers goes through tr_with.
tr_with
The text of a key with its { $name } placeholders filled with typed arguments: text verbatim, numbers formatted for the language.
without_argument_hint
A command’s title as a menu, a toolbar or a tray shows it: without the trailing hint of its arguments (Open a workspace (`path`) reads Open a workspace), which only the palette, where arguments are typed, keeps. It works on a translated title as on the English one.

Type Aliases§

PanelCommands
The commands derived from panels, by command id.