Improve multilingual name fallback logic based on user locale
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.
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 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.
@daishu0000 did you follow the conversation at #11082 ? It looks like a solution is within reach.
but this PR is #11082 :joy:
@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 :-)