Skip to content

Commit

Permalink
Fix i18n loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando committed Jan 28, 2024
1 parent 048f714 commit 5a92548
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/kitabu/exporter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

module Kitabu
class Exporter
def self.default_i18n_load_path
@default_i18n_load_path ||= I18n.load_path.dup.freeze
end

def self.load_translations(root_dir:)
I18n.load_path += Dir[
File.expand_path(File.join(__dir__, "../../../templates/en.yml")),
root_dir.join("config/locales/**/*.{yml,rb}").to_s
]
paths = default_i18n_load_path.dup
paths += Dir[root_dir.join("config/locales/**/*.{yml,rb}").to_s]
paths << File.expand_path(File.join(__dir__, "../../../templates/en.yml"))

I18n.load_path = paths

I18n.backend.reload!
I18n.backend.eager_load!
Expand Down

0 comments on commit 5a92548

Please sign in to comment.