Package su.onno.ui

Class UiMessages

java.lang.Object
su.onno.ui.UiMessages

public final class UiMessages extends Object
The framework's own chrome strings — action buttons, confirmation dialogs, the login screen, empty/loading states, and client-side validation messages — as a single label map with sensible English defaults a deployment can override per key.

The chrome lives in two layers (the server-side DivKit builders and the React app), so the same resolved map feeds both: the DivKit builders read it directly to render server-side, and GET /api/config hands the whole map (asMap()) to the web client, which indexes into it by the same keys. This is the chrome counterpart to the domain localization an app already has (entity title, @Attribute displayName, list-column labels): those cover data/field text, this covers the surrounding shell.

Overrides come from onno.ui.messages (see UiProperties.getMessages()). Scope is one language per deployment — there is no per-request locale negotiation; an app sets the chrome language once and both layers pick it up. A {name}-style placeholder in a template is filled by format(String, Object...).

  • Field Details

    • DEFAULTS

      public static final Map<String,String> DEFAULTS
      The English defaults for every chrome key. Both layers index into this same key namespace; the React app ships a mirror of these as its offline fallback (see lib/messages.ts), so keep the two in sync when adding or changing a key.
  • Constructor Details

    • UiMessages

      public UiMessages(Map<String,String> overrides)
      Builds the resolved map: the English DEFAULTS with the given overrides layered on top.
  • Method Details

    • defaults

      public static UiMessages defaults()
      The all-defaults instance — used by builder overloads and unit tests.
    • get

      public String get(String key)
      The resolved text for key, or the key itself when unknown (so a typo is visible, not blank).
    • format

      public String format(String key, Object... placeholderValues)
      get(String) with {placeholder} substitution: format("ref.new", "name", "Customers")"New Customers". Args are alternating placeholder/value pairs.
    • asMap

      public Map<String,String> asMap()
      The full resolved map — handed to the web client via GET /api/config.