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

Andy Allan notifications at github.com
Wed Mar 2 17:41:50 UTC 2022


@gravitystorm commented on this pull request.



> +          next unless key == "type" && value == "osm-lc" && id != "OSMF"
+
+          raw_local_chapters.push({ :id => id, :resource => resource })
+        end
+      end
+      raw_local_chapters
+    end
+
+    def self.add_to_i18n
+      raw_local_chapters = load_raw_local_chapters
+      files = Dir.glob(Rails.root.join("node_modules/osm-community-index/i18n/*"))
+      files.each do |file|
+        locale = File.basename(file, ".yaml")
+        community_index_yaml = YAML.safe_load(File.read(file))[locale]
+        # rails wants en-GB but osm-community-index has en_GB
+        locale_rails = locale.split("_").join("-")

[`String#tr`](https://ruby-doc.org/core-3.1.1/String.html#method-i-tr) instead of `String.split(foo).join(bar)`

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3301#pullrequestreview-897929707
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3301/review/897929707 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220302/92f7f7e0/attachment.htm>


More information about the rails-dev mailing list