diff --git a/Changes.md b/Changes.md index 1cf6ad3f..06cdb0bb 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,9 @@ +2.10.1 +----------- + +- Remove need for the i18n gem. (brandonhilkert) + + 2.10.0 ----------- diff --git a/lib/sidekiq/version.rb b/lib/sidekiq/version.rb index ef471443..772fd26f 100644 --- a/lib/sidekiq/version.rb +++ b/lib/sidekiq/version.rb @@ -1,3 +1,3 @@ module Sidekiq - VERSION = "2.10.0" + VERSION = "2.10.1" end diff --git a/lib/sidekiq/web.rb b/lib/sidekiq/web.rb index b28b03a2..db41112a 100644 --- a/lib/sidekiq/web.rb +++ b/lib/sidekiq/web.rb @@ -15,15 +15,11 @@ module Sidekiq set :slim, :pretty => true helpers do - def locale_translation_map - @locale_translation_map ||= begin - locale_map = {} - locale_map_files = Dir["#{settings.locales}/*"] - locale_map_files.each do |file| - locale = file.scan(/.*\/(.*)\.yml$/)[0][0] # => 'en' - locale_map[locale] = YAML.load(File.read(file))[locale] + def strings + @strings ||= begin + Dir["#{settings.locales}/*.yml"].inject({}) do |memo, file| + memo.merge(YAML.load(File.read(file))) end - locale_map end end @@ -32,7 +28,7 @@ module Sidekiq end def t(msg, options={}) - string = locale_translation_map[get_locale].fetch(msg) + string = strings[get_locale].fetch(msg) || strings['en'].fetch(msg) string % options end