Skip to content

Commit

Permalink
Only load the english resources for community index if they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Jul 20, 2024
1 parent c0cf556 commit 3debc15
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/osm_community_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit 3debc15

Please sign in to comment.