Skip to main content

TextContent

TextContent is the content-source enum used by Text.

You encounter it when a text widget should either render a literal string directly or look up a translated string from the environment.

Example

use fission::core::ui::{Text, TextContent};

let title = Text::new(TextContent::Key("settings.title".into())).into_node();
let caption = Text::new(TextContent::Literal("Version 1.2.0".into())).into_node();

Choice table

ChoiceTypeMeaningNotes / default behavior
Literal(String)TextContentRender this exact string.Good for dynamic values, ids, or already-translated text.
Key(String)TextContentLook up the string through the current locale in Env.i18n.Missing keys render as MISSING:key in the checked-in implementation.

Specific advice

Use Key for product copy that should participate in internationalization. Use Literal for values that are already data, such as file names, counts, or user input.

Text, RichText, Theming and internationalization, and Env.