ui::Strings¶
Header: winui/core/Strings.hpp.
The text libwinui itself shows or gives screen readers, English by default. An app that shows another language replaces it with set_strings(), and every control follows at once.
A field holding {0} or {1} is a pattern: the control puts a value in each slot, so a translation can place them where its language wants them. {{ and }} write a brace. A field whose wording depends on a number is a function of that number, so a translation can apply its own plural rules.
A control's own text wins over these: a ToggleSwitch with .checked_text shows that, and a Pager with .prefix_text that. Field names stay as they are; new fields are appended.
Example:
ui::Strings german = ui::strings(); // starts from the current set: what is not set stays
german.commands.copy = {"Kopieren", "Die Auswahl in die Zwischenablage kopieren"};
german.commands.select_all = {"Alles auswählen", "Den ganzen Inhalt auswählen"};
german.keys.ctrl = "Strg";
german.toggle_switch.on = "Ein";
german.toggle_switch.off = "Aus";
german.pager.page_number = "Seite {0}";
german.person_picture.badge = [](std::size_t n) { return n == 1 ? "1 Element" : std::format("{} Elemente", n); };
ui::set_strings(std::move(german));
| Field | Type | Default | |
|---|---|---|---|
commands |
StandardCommandsText |
The standard commands. | |
keys |
KeysText |
The key names in shortcut text. | |
common |
CommonText |
Wording several controls share. | |
window_frame |
WindowFrameText |
The caption buttons. | |
text_menu |
TextMenuText |
The text controls' context menus. | |
color_picker |
ColorPickerText |
ColorPicker. | |
toggle_switch |
ToggleSwitchText |
ToggleSwitch. | |
pager |
PagerText |
Pager. | |
tabs |
TabsText |
Tabs. | |
navigation_shell |
NavigationShellText |
NavigationShell. | |
command_bar |
CommandBarText |
CommandBar and CommandBarFlyout. | |
ink_toolbar |
InkToolbarText |
InkToolbar. | |
person_picture |
PersonPictureText |
PersonPicture. | |
file_picker |
FilePickerText |
The file dialogs. | |
date_time |
DateTimeText |
The date and time controls. |
struct CommandText¶
A standard command's text and the description shown as its tooltip.
| Field | Type | Default | |
|---|---|---|---|
text |
std::string |
The label on a button or menu item. | |
description |
std::string |
The tooltip, a sentence saying what the command does. |
struct StandardCommandsText¶
The sixteen standard commands (standard_command()). The text menus of the text controls use the same labels for Cut, Copy, Paste, Select All, Undo and Redo.
| Field | Type | Default | |
|---|---|---|---|
cut |
CommandText |
{"Cut", "Remove the selected content and put it on the clipboard"} |
Cut. |
copy |
CommandText |
{"Copy", "Copy the selected content to the clipboard"} |
Copy. |
paste |
CommandText |
{"Paste", "Insert the contents of the clipboard at the current location"} |
Paste. |
select_all |
CommandText |
{"Select All", "Select all content"} |
Select All. |
delete_selection |
CommandText |
{"Delete", "Delete the selected content"} |
Delete. |
share |
CommandText |
{"Share", "Share the selected content"} |
Share. |
save |
CommandText |
{"Save", "Save your changes"} |
Save. |
open |
CommandText |
{"Open", "Open"} |
Open. |
close |
CommandText |
{"Close", "Close"} |
Close. |
pause |
CommandText |
{"Pause", "Pause"} |
Pause. |
play |
CommandText |
{"Play", "Play"} |
Play. |
stop |
CommandText |
{"Stop", "Stop"} |
Stop. |
forward |
CommandText |
{"Forward", "Go to the next item"} |
Forward. |
backward |
CommandText |
{"Backward", "Go to the previous item"} |
Backward. |
undo |
CommandText |
{"Undo", "Reverse the most recent action"} |
Undo. |
redo |
CommandText |
{"Redo", "Repeat the most recently undone action"} |
Redo. |
struct KeysText¶
The key names in shortcut text ("Ctrl+S"). Letters, digits and F1 to F12 are written as they are.
| Field | Type | Default | |
|---|---|---|---|
ctrl |
std::string |
"Ctrl" |
The Ctrl modifier. |
alt |
std::string |
"Alt" |
The Alt modifier. |
shift |
std::string |
"Shift" |
The Shift modifier. |
win |
std::string |
"Win" |
The Windows key modifier. |
enter |
std::string |
"Enter" |
Enter. |
space |
std::string |
"Space" |
The space bar. |
tab |
std::string |
"Tab" |
Tab. |
escape |
std::string |
"Esc" |
Escape. |
up |
std::string |
"Up" |
The up arrow. |
down |
std::string |
"Down" |
The down arrow. |
left |
std::string |
"Left" |
The left arrow. |
right |
std::string |
"Right" |
The right arrow. |
backspace |
std::string |
"Back" |
Backspace. |
del |
std::string |
"Delete" |
Delete. |
insert |
std::string |
"Insert" |
Insert. |
home |
std::string |
"Home" |
Home. |
end |
std::string |
"End" |
End. |
page_up |
std::string |
"PageUp" |
Page Up. |
page_down |
std::string |
"PageDown" |
Page Down. |
struct CommonText¶
Wording several controls share.
| Field | Type | Default | |
|---|---|---|---|
close |
std::string |
"Close" |
The name of a close button (InfoBar, TeachingTip). |
with_shortcut |
std::string |
"{0} ({1})" |
A tooltip with its shortcut: {0} the text, {1} the shortcut ("Save (Ctrl+S)"). |
struct WindowFrameText¶
The names of the caption buttons a themed window frame draws.
| Field | Type | Default | |
|---|---|---|---|
minimize |
std::string |
"Minimize" |
The minimize button. |
maximize |
std::string |
"Maximize" |
The maximize button while the window is restored. |
restore |
std::string |
"Restore" |
The maximize button while the window is maximized. |
close |
std::string |
"Close" |
The close button. |
struct TextMenuText¶
The text controls' context menus, besides the standard command labels.
| Field | Type | Default | |
|---|---|---|---|
delete_repeated_word |
std::string |
"Delete repeated word" |
Over a word written twice. |
no_spelling_suggestions |
std::string |
"(No spelling suggestions)" |
Over a misspelling with none. |
add_to_dictionary |
std::string |
"Add to dictionary" |
Over a misspelling. |
ignore |
std::string |
"Ignore" |
Over a misspelling. |
bold |
std::string |
"Bold" |
RichEditBox only. |
italic |
std::string |
"Italic" |
RichEditBox only. |
underline |
std::string |
"Underline" |
RichEditBox only. |
struct ColorPickerText¶
| Field | Type | Default | |
|---|---|---|---|
red |
std::string |
"Red" |
The red channel's label. |
green |
std::string |
"Green" |
The green channel's label. |
blue |
std::string |
"Blue" |
The blue channel's label. |
hue |
std::string |
"Hue" |
The hue channel's label. |
saturation |
std::string |
"Saturation" |
The saturation channel's label. |
value |
std::string |
"Value" |
The value channel's label. |
opacity |
std::string |
"Opacity" |
The opacity box's label. |
rgb |
std::string |
"RGB" |
The RGB choice in the representation box. |
hsv |
std::string |
"HSV" |
The HSV choice in the representation box. |
more |
std::string |
"More" |
The button that shows the channel boxes. |
less |
std::string |
"Less" |
The same button while they show. |
percent |
std::string |
"{0}%" |
The opacity box's text: {0} the opacity, 0 to 100. |
struct ToggleSwitchText¶
ToggleSwitch, where it has no text of its own.
| Field | Type | Default | |
|---|---|---|---|
on |
std::string |
"On" |
The label while on. |
off |
std::string |
"Off" |
The label while off. |
struct PagerText¶
| Field | Type | Default | |
|---|---|---|---|
first_page |
std::string |
"First page" |
The First button's name and tooltip. |
previous_page |
std::string |
"Previous page" |
The Previous button's name and tooltip. |
next_page |
std::string |
"Next page" |
The Next button's name and tooltip. |
last_page |
std::string |
"Last page" |
The Last button's name and tooltip. |
prefix |
std::string |
"Page" |
The text before the page box, where the Pager has none of its own. |
suffix |
std::string |
"of" |
The text between the page box and the page count, where the Pager has none of its own. |
page |
std::string |
"Page" |
The page box's name. |
page_number |
std::string |
"Page {0}" |
A page button's name: {0} the page number. |
struct TabsText¶
Tabs.
| Field | Type | Default | |
|---|---|---|---|
close_tab |
std::string |
"Close tab" |
A tab's close button tooltip, with its shortcut. |
add_tab_name |
std::string |
"Add New Tab" |
The add button's name. |
add_tab |
std::string |
"Add new tab" |
The add button's tooltip. |
scroll_backward |
std::string |
"Scroll tab list backward" |
The backward scroll button's tooltip. |
scroll_forward |
std::string |
"Scroll tab list forward" |
The forward scroll button's tooltip. |
struct NavigationShellText¶
| Field | Type | Default | |
|---|---|---|---|
settings |
std::string |
"Settings" |
The settings item. |
open_navigation |
std::string |
"Open Navigation" |
The pane button while the pane is closed. |
close_navigation |
std::string |
"Close Navigation" |
The pane button while the pane is open. |
back |
std::string |
"Back" |
The back button. |
close |
std::string |
"Close" |
The close button of an overlaid pane. |
search |
std::string |
"Click to search" |
The search button of a compact pane. |
more |
std::string |
"More" |
The overflow button of a top pane. |
struct CommandBarText¶
The More button of CommandBar and CommandBarFlyout.
| Field | Type | Default | |
|---|---|---|---|
see_more |
std::string |
"See more" |
The tooltip while closed. |
see_less |
std::string |
"See less" |
The tooltip while open. |
more_options |
std::string |
"More options" |
The name while closed. |
less_options |
std::string |
"Less app bar" |
The name while open. |
struct InkToolbarText¶
| Field | Type | Default | |
|---|---|---|---|
ballpoint_pen |
std::string |
"Ballpoint pen" |
The ballpoint pen tool. |
pencil |
std::string |
"Pencil" |
The pencil tool. |
highlighter |
std::string |
"Highlighter" |
The highlighter tool. |
custom_pen |
std::string |
"Custom pen" |
A custom pen with no name of its own. |
custom_tool |
std::string |
"Custom tool" |
A custom tool with no name of its own. |
eraser |
std::string |
"Eraser" |
The eraser tool. |
colors |
std::string |
"Colors" |
A pen flyout's color heading and palette. |
size |
std::string |
"Size" |
A pen flyout's size heading. |
pen_size |
std::string |
"Pen Size" |
A pen flyout's size slider. |
stroke_preview |
std::string |
"Stroke preview" |
A pen flyout's preview stroke. |
stroke_eraser |
std::string |
"Stroke eraser" |
The eraser flyout's stroke choice. |
point_eraser |
std::string |
"Point eraser" |
The eraser flyout's point choice. |
erase_all_ink |
std::string |
"Erase all ink" |
The eraser flyout's erase-all item. |
ruler |
std::string |
"Ruler" |
The ruler stencil. |
protractor |
std::string |
"Protractor" |
The protractor stencil. |
selected |
std::string |
"{0}, selected" |
A selected tool's name: {0} the tool. |
struct PersonPictureText¶
PersonPicture's name for screen readers.
| Field | Type | Default | |
|---|---|---|---|
group |
std::string |
"Group" |
A group picture. |
person |
std::string |
"Person" |
A person with no name or initials. |
icon |
std::string |
"icon" |
A badge icon with no text. |
badge |
std::function<std::string(std::size_t)> |
[](std::size_t count) { return std::to_string(count) + (count == 1 ? " item" : " items"); } |
A badge number with no text of its own: "1 item", "3 items". |
with_badge |
std::string |
"{0}, {1}" |
The picture's name with its badge: {0} the name, {1} the badge. |
struct DateTimeText¶
CalendarView, CalendarDatePicker, DatePicker and TimePicker.
| Field | Type | Default | |
|---|---|---|---|
previous |
std::string |
"Previous" |
The calendar's button to the previous month, year or decade. |
next |
std::string |
"Next" |
The calendar's button to the next month, year or decade. |
today |
std::string |
"{0}, today" |
A calendar day's name when it is today: {0} the day's own name. |
pick_a_date |
std::string |
"Pick a date" |
What a CalendarDatePicker shows while no date is picked. |
today_footer |
std::string |
"Today: {0}" |
The line under a classic month calendar: {0} today's date. |
day |
std::string |
"day" |
A DatePicker's and TimePicker's parts: what the field shows in each while there is no value, and what automation calls each column. |
month |
std::string |
"month" |
See day. |
year |
std::string |
"year" |
See day. |
hour |
std::string |
"hour" |
See day. |
minute |
std::string |
"minute" |
See day. |
period |
std::string |
"period" |
What automation calls the AM/PM column. |
accept |
std::string |
"Accept" |
The picker flyout's button that keeps the choice. |
dismiss |
std::string |
"Dismiss" |
The picker flyout's button that drops it. |
struct FilePickerText¶
The file dialogs.
| Field | Type | Default | |
|---|---|---|---|
all_files |
std::string |
"All Files" |
The file type entry that lists every type. |