1 module OsmCommunityIndex
3 attr_reader :id, :name, :url
5 @localised_chapters = {}
7 def initialize(id, name, url)
13 def self.local_chapters_with_locale(locale)
14 @localised_chapters[locale] ||= load_local_chapters(locale)
17 def self.load_local_chapters(locale)
18 community_index = OsmCommunityIndex.community_index
19 localised_strings = OsmCommunityIndex.localised_strings(locale)
21 community_index["resources"].each do |id, resource|
22 resource.each do |key, value|
23 next unless key == "type" && value == "osm-lc" && id != "OSMF"
25 strings = resource["strings"]
26 name = localised_strings.dig(id, "name") || strings["name"] || strings["community"]
28 local_chapters.push(LocalChapter.new(id, name, url))