Savvi Studio

UI Locale Adaptivity Pattern

This repository now supports locale-aware feature copy through ui-features templates and schema.org-aligned fields.

Why this pattern

From schema.org/core.sdo, the strongest reusable signals are:

  • schema:inLanguage for default content language
  • schema:availableLanguage for supported locales
  • language tags in BCP 47 form (e.g. en-US, es-US)

Core template contract

modules/src/core.ui.features/templates/entity-view-composition-detailed.aion now accepts:

  • locale-copy.defaultLocale (string)
  • locale-copy.supportedLocales (array)
  • locale-copy.listTitle (object map locale -> string)
  • locale-copy.detailTitle (object map locale -> string)
  • locale-copy.createButtonText (object map locale -> string)
  • locale-copy.listDescription (object map locale -> string)
  • locale-copy.detailDescription (object map locale -> string)

These are persisted on list/detail view resources as:

  • data.inLanguage
  • data.availableLanguage
  • data.localizedTitle
  • data.localizedDescription
  • data.localizedCreateButtonText (list view)

Feature authoring usage

ui-entity-feature and ui-entity-view-feature require a locale-copy object in with.

Minimal example:

type: ui-entity-view-feature
with:
  feature-key: organizations
  entity-type: organizations
  list-title: Organizations
  detail-title: Organization Details
  create-button-text: Create Organization
  route-path: /entities/organizations
  detail-route-path: /entities/organizations/id/:entityId
  list-preset-key: entity-list-default
  list-content-binding-key: organizations-list-content
  detail-header-binding-key: organizations-detail-header
  detail-summary-binding-key: organizations-detail-summary
  actions: [view_details]
  dialog-keys: []
  locale-copy:
    defaultLocale: en-US
    supportedLocales: [en-US]
    listTitle:
      en-US: Organizations
    detailTitle:
      en-US: Organization Details
    createButtonText:
      en-US: Create Organization
    listDescription:
      en-US: Explore organizations connected to sponsor records.
    detailDescription:
      en-US: View organization profile details and linked sponsor data.

Runtime lookup guidance

UI renderers should resolve localized copy by:

  1. Requested locale exact match (xx-YY)
  2. Language-only fallback (xx)
  3. defaultLocale
  4. Existing non-localized fallback fields (title, createButtonText, etc.)

This keeps existing behavior backward compatible while enabling incremental i18n adoption.