ADL 46 · Part VI — Handling, localization, and UI declarations

0.5.1 baseline + 0.6 edition note

Localization

ADL 0.6.0 reference · Review draft 1 · November 14, 2026.

Contents · Source map · Evidence

The 0.6 edition note

This chapter retains the detailed language contract and its source-specific observations. Its chapter number and numbered sections remain stable. The 0.6 additions do not by themselves change this subject’s defaults or supply fresh execution evidence for it.

Reverification should cover locale selection, fallback, and localized diagnostic parameters. Use the original examples and evidence links below to recover the earlier test context. The new edition’s source map records this chapter as inherited detail; the current draft does not claim those historical tests were rerun.

Retained reference detail

The numbered sections below are carried from 46-localization.md. Their original baseline and evidence remain attached to the source. Statements about “current” or “checked” behavior in this retained text refer to those original observations unless the edition note explicitly updates them. This is a consolidated draft, not a claim of complete re-verification.

46.1 Scope and prerequisites

Localization supplies presentation labels and formatting preferences. It does not translate stored records, rename identifiers, select a jurisdiction, or establish data residency. A record identified as catalog.Entry remains the same record when its field label changes from Title to العنوان.

Read ADL 10 for stored values, ADL 11 for enum keys, ADL 20 for validation, and ADL 32 for generated metadata. Client rendering is informative guidance in ADL 47.

This chapter reconciles contradictory statements in the inherited ADL 46 conversion (v0.5.0, retired). The reviewed native implementation is repository revision 6047660f. A working formatting helper, a localized schema action, a record action, and a browser renderer are separate surfaces. Evidence for one does not establish the others. These observations do not ratify a language amendment or declare an entire release cut conformant.

46.2 Declaration and value shapes

Place localization inside the domain. The following is a fragment of the complete localized.yaml domain:

domain:
  name: catalog
  version: 1.0.0
  localization:
    defaultLocale: en
    supportedLocales: [en, ar, fr]
    fallbackChain: [requestedLocale, fr, en]
    dateFormat:
      en: MM/DD/YYYY
      ar: DD/MM/YYYY
    textDirection:
      en: ltr
      ar: rtl
    numberFormat:
      en:
        thousands: ","
        decimal: "."
        currencySymbol: "$"
        currencyPosition: before
    validationMessages:
      en:
        required: "{field} is required"
      ar:
        required: "{field} مطلوب"
MemberShape and native default
defaultLocaleString; en
supportedLocalesArray of locale strings; empty
fallbackChainArray of strings; empty; requestedLocale is a special entry
dateFormatLocale-to-pattern string map; no declared entries
numberFormatLocale-to-format object map; no declared entries
textDirectionLocale-to-string map; no declared entries; use ltr or rtl
validationMessagesLocale-to-message-key-to-string map; no declared entries

An object-valued block, including {}, enables localization. There is no parsed enabled switch inside this block. Without the block it is disabled. The parser filters non-string list/map values in several members and ignores a non-object block; this permissiveness is not validation of an intended locale policy. Supply the stated shapes, rather than relying on silent omission.

Each number-format object defaults to thousands: ",", decimal: ".", currencySymbol: "$", and currencyPosition: before. Formatting uses the after placement only for that exact string; there is no currency conversion.

Inherited declaration discrepancy. The conversion source writes translations.<locale>.validation.<key>. The reviewed parser reads validationMessages.<locale>.<key>. The complete legacy-translations.yaml probe preserves that inherited spelling and records its omission from the native message map. The working example uses the implemented spelling and labels the difference explicitly; accepting the document does not prove that its translations were installed.

The malformed defaultLocale: 42 fixture causes a native JSON conversion exception, rather than a structured declaration diagnostic. The independent modeller instead emits LOCALE_DEFAULT_UNSUPPORTED because the default does not appear in the supported set. The misspelled localisation probe is accepted with an unknown-key warning and localization disabled; it is an intended rejection case that exposes an admission gap.

46.3 Labels and stable identifiers

Resource label and plural, field label, and enum-member label accept a plain string or a map of locale strings. A plain string becomes the registry’s empty-locale entry and can serve as a final fallback.

# Fragment inside domain.resources.
Entry:
  label: {en: Entry, ar: سجل}
  plural: {en: Entries, ar: سجلات}
  object:
    title:
      type: string
      required: true
      label: {en: Title, ar: العنوان}
    notes:
      type: string
      label: {en: Notes, fr: Notes de suivi}

A missing Arabic label for notes deliberately exercises the configured French fallback. The field identifier remains notes. Enum members likewise retain draft and ready; localized display text is not an alternative enum input. Resource collection paths, primary keys, field names, and error codes retain their machine identities. Keep record values separate from labels in a client.

The registry builds keys such as resources.Entry.label, resources.Entry.plural, resources.Entry.fields.title, enums.Status.draft, and validation.required. It does not enumerate every unlabelled schema field as an untranslated key. Coverage is coverage of this registry, not a proof that an application’s complete interface has been translated.

46.4 Request selection and fallback

There are several distinct fallback algorithms in the current implementation. Do not describe them as one universal chain.

SurfaceSelection or fallback
LocaleRegistry::resolveParse comma-separated language preferences, sort by descending q, try exact then base-language match against supported locales; otherwise use the default
Registry label lookupRequested locale, configured chain, default locale, en, empty-locale entry, then first available map entry
Number/date/direction helpersRequested locale’s configuration, default locale’s configuration, built-in default; they do not traverse fallbackChain
Localized validation-message helperField override first; otherwise requested locale, default locale, en, supplied default message

The requestedLocale token in fallbackChain is skipped because the requested locale is already first. Duplicate entries are removed. Missing keys return an empty string from registry lookup; callers decide whether to retain or supply another label. There is no universal raw-key fallback inside that helper.

With no supportedLocales, resolution trusts the leading requested tag. Matching is case-sensitive. The current resolver does not discard a language solely because its weight is zero, so it is not a complete implementation of HTTP language negotiation. The evidence includes base-language, weighted, unsupported, uppercase, wildcard, and zero-weight requests.

The actual request surfaces also differ:

  • The schema action uses a nonempty explicit locale directly. Otherwise it resolves Accept-Language (also recognizing the lowercase header spelling). With neither input it leaves the schema unlocalized and adds no locale stamp.
  • Generated get and list actions resolve an explicit locale through the supported-locale list, then try the header, then the default. They add _meta.locale to the response data object.
  • Localization administration actions use a nonempty explicit locale directly; otherwise they resolve the header or take the default.

An explicit unsupported locale can consequently be echoed by schema or missing translation output while the same request to get/list resolves to en. The recorded cases preserve that difference instead of inventing a shared policy.

46.5 Formatting and direction

The native LocaleRegistry helpers execute formatting. They do not rewrite stored values, and the ordinary CRUD response path does not call them to format every number or timestamp.

HelperBehavior
format_numberThousands separators and decimal separator, two fractional digits
format_moneyNumber formatting with two fractional digits and configured symbol/placement
format_percentageOne fractional digit plus %; no multiplication by 100
format_dateDate-part token substitution; a timestamp’s time portion is omitted
text_direction_forConfigured string or fallback ltr; no locale-derived inference

Date patterns recognize YYYY, YY, MM, M, DD, and D, with longer tokens matched first. For 2026-03-07, MM/DD/YYYY yields 03/07/2026 and DD/MM/YYYY yields 07/03/2026. The old example MMM d, yyyy is not a supported month-name pattern: uppercase M is substituted while lowercase tokens remain literal. There is no general date-pattern library, timezone conversion, calendar conversion, or month-name localization here.

The helper checks the first ten characters for digits and hyphens in the expected positions. Unrecognized input is returned unchanged; it is not a full calendar-validity check. Declaration validation and stored-value validation remain separate concerns.

LocaleRegistry::localized_schema produces a compact presentation object with locale, textDirection, dateFormat, resources, and enums. It is a C++ helper result, not the payload of the domain schema action. In particular, mentioning this helper does not establish that the HTTP schema endpoint exposes its top-level direction/date members. The browser example consumes the separately identified helper output and demonstrates rendering explicitly.

46.6 Observable schema, records, and messages

GET /api/v1/domains/{name}/schema is the management route for the schema action. Its source-based domain object retains declaration metadata and adds resource collection information. The current response exposes both object and fields for a resource. Localization rewrites field labels in fields; the retained object alias can still contain locale maps. Resource labels/plurals and enum member labels are rewritten separately. A client must choose the documented projection rather than mix the aliases.

The native fixture dispatches this action and record actions through the kernel, using a disposable SQLite store. The English and Arabic get/list responses keep Original, Untranslated record, the amount (returned as decimal text), dates, and draft unchanged; only locale metadata differs. Physical table rows are inspected after the requests to check the persistence boundary.

ResourceValidator::localized_message can interpolate {field} using a localized field label. A nonempty field messages.<constraint> override wins and is returned verbatim, including any unexpanded placeholder. This helper’s existence does not establish localized ordinary CRUD errors: the reviewed create/update paths do not call it. The missing-title request separately records the actual generated validation response. No claim is made that history event labels, template output, or every diagnostic uses the locale registry.

Model export and registry restoration are also separate surfaces. The evidence compares the parsed configuration with source-backed reconstruction and forced source-free reconstruction. Retaining original/resolved source matters where model serialization omits presentation configuration; a successful export is not a lossless localization round trip. The checked exporter and forced source-free reload lose the localization block and resource/field label maps; source-backed reconstruction preserves the parsed configuration.

46.7 Translation administration

When localization is enabled, generated routes under the domain API prefix include the following operations. Each handler requires admin or administrator; a resource’s public read permission does not grant these administration actions.

Relative routeAction result
GET /localization/coveragedefaultLocale, totalKeys, and translated/total/percentage values for each supported locale
GET /localization/missingRequested locale, missing key/default-value pairs, and totalCount
GET /localization/exportLocale, format, and body; yaml selects text, other format strings currently select JSON
POST /localization/import501 NOT_IMPLEMENTED after the role check

Coverage counts explicit entries, including empty strings, for each locale. Fallback display text does not increase that count. A locale-independent string at the empty key can display everywhere yet still count as missing for both English and Arabic. An empty translation registry reports 100 percent for a supported locale; an empty supported-locale list yields no per-locale rows.

Missing-key defaults prefer the default locale, then en, then the first available entry. They do not use the requested locale’s complete display fallback. Export includes only explicit translations for its locale. The YAML export is an administration exchange shape beginning with locale, not a complete adl domain document. Import is not a working round-trip installation workflow in this build. Non-admin requests return 403 FORBIDDEN for all four operations, including import.

46.8 Checked examples and limits

The example dossier supplies seven complete documents: the localized domain, empty-block defaults, inherited message spelling, a misspelled declaration, a scalar-block omission probe, a malformed default-locale value, and a field-message override. Deliberate rejection and permissive-parser outcomes are labelled individually in the evidence.

The browser artifact renders the same stored record under English and Arabic labels, checks the French label fallback, compares date and amount display, changes direction, and verifies unchanged record data. Its native inputs are tied to the reviewed build; its renderer is an informative client, not an ADL runtime feature. Formatting does not determine currency value, timezone, access rights, retention, jurisdiction, or storage location.

The evidence record distinguishes production parser/model behavior, independently run modeller results, direct C++ helpers, kernel-dispatched actions, and the browser check. It links the actual source files and records their revision and hashes without copying production sources.