iD icon indicating copy to clipboard operation
iD copied to clipboard

Improve multilingual name fallback logic based on user locale

Open daishu0000 opened this issue 7 months ago • 4 comments

Introduction

This PR enhances the multilingual support for feature names in the map by allowing multiple fallback languages to be used when displaying name:* tags. This improves localization and ensures that users see names in their preferred or most appropriate language.

Main Changes

  • Multiple language fallbacks for names:
    Instead of checking only a single name: tag, the logic now iterates through a prioritized list of language codes based on the user's locale preferences. If no localized tag is found in any of the preferred languages, it falls back first to name:en, and if that is also not available, finally falls back to the general name tag.

  • Special handling for Chinese variants:
    Added remapping logic to better support Chinese language variants by mapping locale codes to appropriate language tags.

daishu0000 avatar Jun 02 '25 07:06 daishu0000

Hi @tyrasd, Could you please check my PR? I think it's an important PR for the users that want to see names of different languages in ID editor. And it also can solve the problem of showing traditional and simplifiled Chinese. Thank you very much!

daishu0000 avatar Jun 08 '25 16:06 daishu0000

@daishu0000 did you follow the conversation at ~https://github.com/openstreetmap/iD/pull/11082~ https://github.com/openstreetmap/iD/pull/10911 ? It looks like a solution is within reach.

tordans avatar Jun 08 '25 18:06 tordans

@daishu0000 did you follow the conversation at #11082 ? It looks like a solution is within reach.

but this PR is #11082 :joy:

daishu0000 avatar Jun 09 '25 12:06 daishu0000

@daishu0000 did you follow the conversation at #11082 ? It looks like a solution is within reach.

but this PR is #11082 😂

Sorry, https://github.com/openstreetmap/iD/pull/10911 :-)

tordans avatar Jun 09 '25 14:06 tordans