Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure the translations on initialization #1

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ice_cube.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require "date"
require "ice_cube/deprecated"
require "ice_cube/i18n"

module IceCube
autoload :VERSION, "ice_cube/version"

autoload :TimeUtil, "ice_cube/time_util"
autoload :FlexibleHash, "ice_cube/flexible_hash"
autoload :I18n, "ice_cube/i18n"

autoload :Rule, "ice_cube/rule"
autoload :Schedule, "ice_cube/schedule"
Expand Down
4 changes: 3 additions & 1 deletion lib/ice_cube/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ def self.backend
end

def self.detect_backend!
::I18n.load_path += Dir[File.join(LOCALES_PATH, "*.yml")]
::I18n
rescue NameError
NullI18n
end
end
end

# Load the translations early in order not to override the user’s translations.
::I18n.load_path += Dir[File.join(IceCube::I18n::LOCALES_PATH, "*.yml")] if defined? I18n
Loading