Filter out the communities before loading the translations

This avoids loading excessive numbers of translations
This commit is contained in:
Andy Allan 2022-08-10 17:34:24 +01:00
parent bf1f882eb8
commit 7e62e2b5ed

View file

@ -1,6 +1,8 @@
module OsmCommunityIndex
def self.add_to_i18n
communities = Community.all
# Filter the communities here to avoid loading excessive numbers of translations
communities = Community.where(:type => "osm-lc").where.not(:id => "OSMF")
files = Dir.glob(Rails.root.join("node_modules/osm-community-index/i18n/*.yaml"))
files.each do |file|
locale = File.basename(file, ".yaml")