Skip to content

Commit

Permalink
🧹 Change locale file load order so that our local files are prioritized
Browse files Browse the repository at this point in the history
We add our local config locale directory to the I18n.load_path so that our local files take precendence over the ones found in our gems.

Related issue:
- scientist-softserv/hykuup_knapsack#55
  • Loading branch information
ShanaLMoore committed Jan 2, 2024
1 parent 5e58fd9 commit 4162498
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ def self.path_for(relative_path)
# Seems at some point `ActiveRecord::Base.yaml_column_permitted_classes` loses all the values we set above
# so we need to set it again here.
ActiveRecord::Base.yaml_column_permitted_classes = yaml_column_permitted_classes

# Because we're loading local translations early in the to_prepare block for our decorators,
# the I18n.load_path is out of order. This line ensures that we load local translations last.
I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.yml')]
end
end
end

0 comments on commit 4162498

Please sign in to comment.