From 3debc151a86ed0016364d2d1348ecd82f5fa75fc Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 20 Jul 2024 12:10:29 +0100 Subject: [PATCH] Only load the english resources for community index if they exist --- lib/osm_community_index.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/osm_community_index.rb b/lib/osm_community_index.rb index 9afb33a7e..11383dd16 100644 --- a/lib/osm_community_index.rb +++ b/lib/osm_community_index.rb @@ -2,7 +2,11 @@ module OsmCommunityIndex def self.add_to_i18n # Filter the communities here to avoid loading excessive numbers of translations communities = Community.where(:type => "osm-lc").where.not(:id => "OSMF") - community_en_yaml = YAML.safe_load_file("node_modules/osm-community-index/i18n/en.yaml")["en"] + community_en_yaml = if File.exist?("node_modules/osm-community-index/i18n/en.yaml") + YAML.safe_load_file("node_modules/osm-community-index/i18n/en.yaml")["en"] + else + {} + end files = Rails.root.glob("node_modules/osm-community-index/i18n/*.yaml") files.each do |file| -- 2.39.5