Skip to content

[fallback] Resolve language priority through references - #33

Merged
biodranik merged 2 commits into
organicmapsfrom
ab/fix-regional-reference-fallback
Oct 16, 2026
Merged

biodranik merged 2 commits into
organicmapsfrom
ab/fix-regional-reference-fallback

Conversation

@biodranik

@biodranik biodranik commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Resolve requested languages in priority order across references, so regional locales inherit their base translation before another language's local override. Preserve explicit empty translations and chained references in Ruby and Python.

Keep deduplication consistent with generation: remove an override only when its effective replacement is identical, retain exact-language values needed by aliases, and preserve the developer-language fallback. Cover inherited script/generic values, alias consumers and a regional developer language through optimization and write/read round trips.

Related: #8.

Validation:

  • Python 3.12: 147 tests passed; Ruff clean.
  • Ruby: 224 tests, 534 assertions, one existing skip; no failures.
  • In-memory localization generation: 627 files and six skips; only the expected fr-CA, pt-BR and es-MX type files differ from the base.

Pre-existing issues are handled independently in #34 (Python) and #35 (Ruby). The three PRs merge cleanly together and pass 182 Python tests and 238 Ruby tests (one existing skip).

Implementation and validation assisted by Codex.

Prefer a reference's translation in a requested language before falling back
to another language's override. This keeps regional locales in their base
language instead of selecting English labels.

Cover language order, chained references, explicit overrides and empty
translations in both maintained implementations.

Signed-off-by: Alexander Borsuk <me@alex.bio>
@biodranik
biodranik requested a review from strump October 15, 2026 22:19
Compare overrides with the translation selected by language and reference
priority. Keep exact-language values needed by aliases and the developer
language, and apply removals sequentially to preserve fallback availability.

Cover inherited script and generic translations, alias consumers, and a
regional developer language through optimization and file round trips.

Signed-off-by: Alexander Borsuk <me@alex.bio>
@biodranik
biodranik merged commit 2d0a0ed 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