]> git.openstreetmap.org Git - rails.git/commitdiff
Move the i18n loading to an initializer
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 2 Mar 2022 16:24:02 +0000 (16:24 +0000)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 2 Mar 2022 16:24:02 +0000 (16:24 +0000)
Use after_initialize to avoid rails resetting the translations

app/controllers/site_controller.rb
config/initializers/osm_community_index.rb [new file with mode: 0644]

index a73d1e2e50e74f9595605917440a60a5cf7ba4f5..524001d4db926fca2c4511451843e035fa0df25d 100644 (file)
@@ -107,7 +107,6 @@ class SiteController < ApplicationController
   end
 
   def communities
   end
 
   def communities
-    OsmCommunityIndex::LocalChapter.add_to_i18n # this should be called on app init
     @local_chapters = OsmCommunityIndex::LocalChapter.local_chapters
   end
 
     @local_chapters = OsmCommunityIndex::LocalChapter.local_chapters
   end
 
diff --git a/config/initializers/osm_community_index.rb b/config/initializers/osm_community_index.rb
new file mode 100644 (file)
index 0000000..1400ef0
--- /dev/null
@@ -0,0 +1,3 @@
+Rails.configuration.after_initialize do
+  OsmCommunityIndex::LocalChapter.add_to_i18n
+end