ObjectStackObjectStack

Translation

Translation protocol schemas

Field Translation Schema

Translation data for a single field.

Source: packages/spec/src/system/translation.zod.ts

TypeScript Usage

import { AppTranslationBundle, CoverageBreakdownEntry, FieldTranslation, Locale, MessageFormat, ObjectTranslationData, ObjectTranslationNode, TranslationBundle, TranslationConfig, TranslationCoverageResult, TranslationData, TranslationDiffItem, TranslationDiffStatus, TranslationFileOrganization } from '@objectstack/spec/system';
import type { AppTranslationBundle, CoverageBreakdownEntry, FieldTranslation, Locale, MessageFormat, ObjectTranslationData, ObjectTranslationNode, TranslationBundle, TranslationConfig, TranslationCoverageResult, TranslationData, TranslationDiffItem, TranslationDiffStatus, TranslationFileOrganization } from '@objectstack/spec/system';

// Validate data
const result = AppTranslationBundle.parse(data);

AppTranslationBundle

Object-first application translation bundle for a single locale

Properties

PropertyTypeRequiredDescription
_metaObjectoptionalBundle-level metadata (locale, bidi direction)
namespacestringoptionalNamespace for plugin isolation to avoid translation key collisions
oRecord<string, Object>optionalObject-first translations keyed by object name
_globalOptionsRecord<string, Record<string, string>>optionalGlobal picklist option translations keyed by option set name
appRecord<string, Object>optionalApp translations keyed by app name
navRecord<string, string>optionalNavigation item translations keyed by nav item name
dashboardRecord<string, Object>optionalDashboard translations keyed by dashboard name
reportsRecord<string, Object>optionalReport translations keyed by report name
pagesRecord<string, Object>optionalPage translations keyed by page name
messagesRecord<string, string>optionalUI message translations keyed by message ID (supports ICU MessageFormat)
validationMessagesRecord<string, string>optionalValidation error message translations keyed by rule name (supports ICU MessageFormat)
notificationsRecord<string, Object>optionalGlobal notification translations keyed by notification name
errorsRecord<string, string>optionalGlobal error message translations keyed by error code

CoverageBreakdownEntry

Coverage breakdown for a single translation group

Properties

PropertyTypeRequiredDescription
groupstringTranslation group category
totalKeysintegerTotal keys in this group
translatedKeysintegerTranslated keys in this group
coveragePercentnumberCoverage percentage for this group

FieldTranslation

Translation data for a single field

Properties

PropertyTypeRequiredDescription
labelstringoptionalTranslated field label
helpstringoptionalTranslated help text
placeholderstringoptionalTranslated placeholder text for form inputs
optionsRecord<string, string>optionalOption value to translated label map


MessageFormat

Message interpolation format: ICU MessageFormat or simple {variable} replacement

Allowed Values

  • icu
  • simple

ObjectTranslationData

Translation data for a single object

Properties

PropertyTypeRequiredDescription
labelstringTranslated singular label
pluralLabelstringoptionalTranslated plural label
fieldsRecord<string, Object>optionalField-level translations

ObjectTranslationNode

Object-first aggregated translation node

Properties

PropertyTypeRequiredDescription
labelstringTranslated singular label
pluralLabelstringoptionalTranslated plural label
descriptionstringoptionalTranslated object description
helpTextstringoptionalTranslated help text for the object
fieldsRecord<string, Object>optionalField translations keyed by field name
_optionsRecord<string, Record<string, string>>optionalObject-scoped picklist option translations keyed by field name
_viewsRecord<string, Object>optionalView translations keyed by view name
_sectionsRecord<string, Object>optionalSection translations keyed by section name
_actionsRecord<string, Object>optionalAction translations keyed by action name
_notificationsRecord<string, Object>optionalNotification translations keyed by notification name
_errorsRecord<string, string>optionalError message translations keyed by error code


TranslationConfig

Internationalization configuration

Properties

PropertyTypeRequiredDescription
defaultLocalestringDefault locale (e.g., "en")
supportedLocalesstring[]Supported BCP-47 locale codes
fallbackLocalestringoptionalFallback locale code
fileOrganizationEnum<'bundled' | 'per_locale' | 'per_namespace'>File organization strategy
messageFormatEnum<'icu' | 'simple'>Message interpolation format (ICU MessageFormat or simple)
lazyLoadbooleanLoad translations on demand
cachebooleanCache loaded translations

TranslationCoverageResult

Aggregated translation coverage result

Properties

PropertyTypeRequiredDescription
localestringBCP-47 locale code
objectNamestringoptionalObject name scope (omit for full bundle)
totalKeysintegerTotal translatable keys from metadata
translatedKeysintegerNumber of translated keys
missingKeysintegerNumber of missing translations
redundantKeysintegerNumber of redundant translations
staleKeysintegerNumber of stale translations
coveragePercentnumberTranslation coverage percentage
itemsObject[]Detailed diff items
breakdownObject[]optionalPer-group coverage breakdown

TranslationData

Translation data for objects, apps, and UI messages

Properties

PropertyTypeRequiredDescription
objectsRecord<string, Object>optionalObject translations keyed by object name
appsRecord<string, Object>optionalApp translations keyed by app name
messagesRecord<string, string>optionalUI message translations keyed by message ID
validationMessagesRecord<string, string>optionalTranslatable validation error messages keyed by rule name (e.g., {"discount_limit": "折扣不能超过40%"})

TranslationDiffItem

A single translation diff item

Properties

PropertyTypeRequiredDescription
keystringDot-path translation key
statusEnum<'missing' | 'redundant' | 'stale'>Diff status of this translation key
objectNamestringoptionalAssociated object name (snake_case)
localestringBCP-47 locale code
sourceHashstringoptionalHash of source metadata for precise stale detection
aiSuggestedstringoptionalAI-suggested translation for this key
aiConfidencenumberoptionalAI suggestion confidence score (0–1)

TranslationDiffStatus

Translation diff status: missing from bundle, redundant (no matching metadata), or stale (metadata changed)

Allowed Values

  • missing
  • redundant
  • stale

TranslationFileOrganization

Translation file organization strategy

Allowed Values

  • bundled
  • per_locale
  • per_namespace

On this page