Skip to content

Use mapper-provided romanized names (ja-Latn, ko-Latn) instead of machine transliteration#25425

Open
MiMoHo wants to merge 2 commits into
osmandapp:masterfrom
MiMoHo:fix-latin-script-names
Open

Use mapper-provided romanized names (ja-Latn, ko-Latn) instead of machine transliteration#25425
MiMoHo wants to merge 2 commits into
osmandapp:masterfrom
MiMoHo:fix-latin-script-names

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #25267

Problem

For objects without name:en, OsmAnd falls back to machine transliteration (Junidecode), which produces wrong results especially for Japanese — kanji get Chinese readings. Example from the issue, way 1175336500 (大山阿夫利神社, name:ja-Latn = "Oyama Afuri Jinja"):

  • current English fallback: "Da Shan A Fu Li Shen She"
  • mapper-provided romanization: "Oyama Afuri Jinja"

The mapper-provided names can't even be used today because name:ja-Latn (165,044 uses) and name:ko-Latn (138,850 uses) are not in MapRenderingTypes.langs, so they are dropped during map creation (unlike sr-latn / zh-hans / zh-hant, which are already indexed).

Changes

  1. MapRenderingTypes.langs: add ja-latn and ko-latn (placed next to ja / ko, matching the existing sr-latn style). Takes effect once maps are regenerated.
  2. EntityParser.parseMapObject(): lowercase the language suffix before the langsSet lookup and store names under the lowercase code. Production parsing already lowercases tag keys (Entity.putTag), but code paths using putTagNoLC — e.g. the OSM editing download, which sets setConvertTagsToLC(false) — preserve OSM's BCP 47 capitalization (name:ja-Latn, name:sr-Latn) and previously failed the lookup.
  3. MapObject.getEnName(true): prefer a stored Latin-script name (key ending in -latn) over machine transliteration when name:en is missing. Explicit name:en still wins; behavior with transliteration disabled is unchanged; objects without a romanized name fall back to Junidecode exactly as before.

int_name (907k uses) could be a further fallback candidate, but it is not indexed today and not guaranteed to be Latin script, so it is left out of this PR.

Testing

Compiled the patched classes against the current master snapshot jar and ran a standalone test (class-shadowing), 14 checks — all pass with the patch; the unpatched jar shows the current behavior:

Check Unpatched master Patched
name:ja-Latn indexed (lowercased keys, production path) dropped ja-latn
name:ko-Latn indexed dropped ko-latn
name:ja-Latn/name:sr-Latn via case-preserving path (putTagNoLC) dropped indexed ✓
getEnName(true) for 大山阿夫利神社 with ja-Latn "Da Shan A Fu Li Shen She" "Oyama Afuri Jinja"
name:sr-latn, name:zh-Hans, name:de (production path) indexed indexed (unchanged)
unknown language suffix dropped dropped (unchanged)
explicit name:en precedence wins wins (unchanged)
Junidecode fallback without romanized name (Москва) "Moskva" "Moskva" (unchanged)
getEnName(false) without name:en empty empty (unchanged)

Claude Code — Claude Fable 5, xhigh

MiMoHo and others added 2 commits July 11, 2026 18:12
name:ja-Latn (165k uses) and name:ko-Latn (139k uses) were dropped during
map creation because the language list did not contain them. Also harden
EntityParser to accept BCP 47 capitalized language suffixes: production
parsing lowercases tag keys, but paths using putTagNoLC (e.g. the OSM
editing download with setConvertTagsToLC(false)) preserve the original
case and previously failed the langsSet lookup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When name:en is missing and transliteration is enabled, use a stored
romanized name (name:ja-Latn, name:ko-Latn, name:sr-Latn, ...) before
falling back to Junidecode, which e.g. renders Japanese kanji with
Chinese readings (大山阿夫利神社 -> "Da Shan A Fu Li Shen She" instead of
the mapper-provided "Oyama Afuri Jinja").

Fixes osmandapp#25267

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

Map Localization: Use name:ja-Latn as a fallback for English name if name:en is missing

1 participant