Documentation
¶
Overview ¶
Package localization owns locale request resolution and the logical single-locale/canonical-storage transform shared by operation engines and strict store fixtures.
Index ¶
- func CopyLocaleIssues(fields []schema.Field, values store.Values) []schema.Issue
- func LocalizedValues(fields []schema.Field, values store.Values) store.Values
- func MergeStoragePatch(fields []schema.Field, current, patch store.Values) store.Values
- func MergeStorageUpdate(fields []schema.Field, current, patch store.Values) store.Values
- func ParseFallbackQuery(value string) ([]schema.LocaleCode, bool, error)
- func ProjectDocument(document store.Document, fields []schema.Field, selection Selection) store.Document
- func StoragePatch(fields []schema.Field, values store.Values, selection Selection) (store.Values, error)
- type Selection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyLocaleIssues ¶
CopyLocaleIssues rejects structured localized copies that cannot match rows back to their canonical storage counterparts. Positional matching would let stale or reordered input overwrite non-localized siblings, so row keys are a safety requirement for non-localized arrays and blocks with localized descendants.
func LocalizedValues ¶
LocalizedValues extracts only localized authored values from one projected document. Row identity and block discriminators are retained so a copy-to-locale update can merge nested values without replacing shared structure or non-localized siblings.
func MergeStoragePatch ¶
MergeStoragePatch combines partial locale maps during an update.
func MergeStorageUpdate ¶
MergeStorageUpdate expands submitted structured fields against their current canonical value while keeping the update limited to top-level fields present in the patch. PostgreSQL stores groups, arrays, and blocks as one JSON value, so this makes its patch semantics match stores that merge those values in memory: omitted nested fields are preserved, explicit nulls still clear, and keyed row lists may still remove whole rows by omitting the row itself.
func ParseFallbackQuery ¶
func ParseFallbackQuery(value string) ([]schema.LocaleCode, bool, error)
ParseFallbackQuery accepts Payload-compatible disable tokens or a comma-separated fallback chain. A nil slice means no explicit override.
Types ¶
type Selection ¶
type Selection struct {
Locale schema.LocaleCode
Chain []schema.LocaleCode
All bool
Configured []schema.LocaleCode
}
Selection is one validated request locale and its effective fallback chain.
func Resolve ¶
func Resolve(settings *schema.LocalizationSettings, locale string, explicitFallback []schema.LocaleCode, disableFallback, all bool) (Selection, error)
Resolve validates request locale input. ExplicitFallback replaces configured fallback behavior. DisableFallback prevents both locale and default fallback.