literalText static method

String literalText(
  1. String message
)

The human-visible literal text of message, with ICU expressions reduced to only the copy a reader actually sees.

A placeholder variable name is NOT copy — {journey} interpolates a value, it does not put the word "journey" on screen — so simple and typed placeholders are dropped entirely. Plural / select / selectordinal branch bodies ARE copy and are kept (every branch, not just other), while the selector variable and keyword are dropped. Nested expressions recurse under the same rule. Literal runs (including quoted runs) pass through.

Examples: 'Step · {journey}''Step · ' (placeholder gone). '{n, plural, one{1 journey} other{{n} journeys}}'' 1 journey journeys' (branch copy kept, {n} gone). 'Hello {name}!''Hello !'.

Used by the glossary check and the translate worklist so a term that appears only as a placeholder name never demands translation (feedback #6, 2026-07-18).

Implementation

static String literalText(String message) {
  final buf = StringBuffer();
  _collectLiteral(message, buf);
  return buf.toString();
}