[openstreetmap/openstreetmap-website] Use same logic for feature names (PR #6037)
    Anton Khorev 
    notifications at github.com
       
    Mon May 26 14:49:09 UTC 2025
    
    
  
@AntonKhorev commented on this pull request.
> +    preferred_languages.expand.each do |locale|
+      key = "name:#{locale}"
+      return tags[key] if tags[key]
+
+      key = "name:#{locale.to_s.split('-').first}"
+      return tags[key] if tags[key]
+    end
`expand` adds candidate languages that include dropping territory subtags. That makes `split('-').first` unnecessary.
```
open-street-map(dev)> u.preferred_languages.map &:to_s
=> ["en-US", "ru-RU"]
open-street-map(dev)> u.preferred_languages.expand.map &:to_s
=> ["en-US", "en", "ru-RU", "ru"]
```
-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6037#pullrequestreview-2868668409
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6037/review/2868668409 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250526/1624f212/attachment.htm>
    
    
More information about the rails-dev
mailing list