[openstreetmap/openstreetmap-website] Add Communities page (#3301)

Adam Hoyle notifications at github.com
Sun Oct 17 22:04:24 UTC 2021


@atomoil commented on this pull request.



> +    def self.local_chapters_with_locale(locale)
+      @localised_chapters[locale] ||= load_local_chapters(locale)
+    end
+
+    protected
+
+    def self.load_local_chapters(locale)
+      community_index = OsmCommunityIndex.community_index
+      localised_strings = OsmCommunityIndex.localised_strings(locale)
+      local_chapters = []
+      community_index["resources"].each do |id, resource|
+        resource.each do |key, value|
+          next unless key == "type" && value == "osm-lc" && id != "OSMF"
+
+          strings = resource["strings"]
+          name = localised_strings.dig(id, "name") || strings["name"] || strings["community"]

I raised this with the osm-community-index team, and this code was the result of our conversation here: https://github.com/osmlab/osm-community-index/issues/483.

Would it help to add a comment referencing this github issue?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3301#discussion_r730483526
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20211017/0739f166/attachment.htm>


More information about the rails-dev mailing list