1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Refactor i18n removal, update changelog

This commit is contained in:
Mike Perham 2013-04-15 16:54:17 -07:00
parent d827b06d92
commit e9b1adf917
3 changed files with 12 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2.10.1
-----------
- Remove need for the i18n gem. (brandonhilkert)
2.10.0
-----------

View file

@ -1,3 +1,3 @@
module Sidekiq
VERSION = "2.10.0"
VERSION = "2.10.1"
end

View file

@ -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