Class: Spree::Api::V3::Admin::ResourceTranslationsSerializer
- Inherits:
-
Object
- Object
- Spree::Api::V3::Admin::ResourceTranslationsSerializer
- Includes:
- Alba::Resource
- Defined in:
- app/serializers/spree/api/v3/admin/resource_translations_serializer.rb
Overview
Serializes a translatable record's translation payload — the locale ×
field matrix, optionally with self-describing discovery fields, the
locale envelope, and nested translatable children.
Params select the shape:
fields: true— includefields(key/type/source) and nestedchildren(e.g. an option type's option values). The read endpoint (GET …/:id/translations) uses this so an editor fetches the whole tree in one request.envelope: true— include +default_locale+/+supported_locales+ from the record's own translatable store (so they can't contradict the matrix). The top-level read node and each batch-write echo carry it; nested children do not.
The batch write echo passes fields: false (matrix only); the read
endpoint passes both true at the top level and re-renders children
with envelope: false.
Deliberately does NOT include Typelizer::DSL: the payload is computed
(matrix/fields/children resolve to unknown), so the admin-sdk ships
richer hand-written types in src/types/translations.ts instead.
Without the DSL, Typelizer never enumerates this serializer.