@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/2868668...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev