[openstreetmap/openstreetmap-website] Apply lang attribute to localized name:* values (#6834) (PR #6854)
Minh Nguyễn
notifications at github.com
Fri Mar 13 20:35:59 UTC 2026
@1ec5 commented on this pull request.
> + def browse_tag_value_cell(tag)
+ options = {
+ :class => "py-1 border-secondary-subtle border-start",
+ :dir => "auto"
+ }
+
+ lang = tag_language(tag[0])
+ options[:lang] = lang if lang
+
+ content_tag :td, format_value(tag[0], tag[1]), **options
+ end
+
+ def tag_language(key)
+ key[/\Aname:([a-z]{2,3}(?:-[A-Za-z0-9]+)*)\z/, 1]
+ end
+
That’s my fault for mentioning a helper method in https://github.com/openstreetmap/openstreetmap-website/pull/6854#discussion_r2902158872. I was thinking there might be more places to validate language codes. However, this regex includes `name:` and is pretty lenient about what comes after, so it wouldn’t be useful for that purpose.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6854#discussion_r2933651545
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6854/review/3946837251 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260313/b551b334/attachment.htm>
More information about the rails-dev
mailing list