Skip to content

[ruby] Preserve source data and inherited plural output - #35

Merged
biodranik merged 1 commit into
organicmapsfrom
ab/ruby-reference-correctness
Oct 16, 2026
Merged

biodranik merged 1 commit into
organicmapsfrom
ab/ruby-reference-correctness

Conversation

@biodranik

@biodranik biodranik commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Generating a regional locale mutates the parsed definitions, so an alias can change from Pedestrian Bridge to Bridge when its reference appears first. Plural aliases also lose their forms, and Gettext export can crash when developer text is inherited.

  • Give duplicated definitions independent translation, plural and tag collections while keeping reference objects shared. Generation becomes repeatable and independent of definition order.
  • Resolve plural forms through references and choose the output resource type for the requested language. Explicit singular and empty values override inherited plurals. Preserve every resolved fallback form and keep empty plural output skippable.
  • Reuse reference lookup for Gettext developer text, including the developer-language option. Reject dangling references and cycles during reading and explicit validation.
  • Compute fallback languages once per output, use a constant script mapping, and support three-letter base languages. This keeps the simplification at the processor boundary and leaves [fallback] Resolve language priority through references #33's language-priority lookup change separate.

Based directly on organicmaps; contains only Ruby changes. Related review: #33. This PR can be reviewed independently of #33.

Validation:

Implementation and validation assisted by Codex.

Give copied definitions independent mutable maps so generated fallbacks do
not change their sources or depend on definition order. Resolve plural forms
through references, preserving explicit singular overrides and Gettext
developer text.

Compute fallbacks once per language, support script and three-letter locale
fallbacks, and reject invalid reference graphs before inherited lookups.
Keep empty plural output skippable.

Cover ownership, output types, fallback order, and reference validation.

Signed-off-by: Alexander Borsuk <me@alex.bio>
@biodranik
biodranik merged commit 2e99cdb into organicmaps Oct 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant