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)
19 def self.load_local_chapters(locale)
20 community_index = OsmCommunityIndex.community_index
21 localised_strings = OsmCommunityIndex.localised_strings(locale)
23 community_index["resources"].each do |id, resource|
24 resource.each do |key, value|
25 next unless key == "type" && value == "osm-lc" && id != "OSMF"
27 strings = resource["strings"]
28 name = localised_strings.dig(id, "name") || strings["name"] || strings["community"]
30 local_chapters.push(LocalChapter.new(id, name, url))