40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/i18n_auto_scoping.rb', line 40
def self.extended(k)
k.class_eval do
alias_method :i18n_auto_scoping_translate, :translate
def translate(locale, key, options = {})
if !options.has_key?(:scope) or options[:scope] == :autoscoping
options[:scope] = I18n::Scope.default
end
begin
result = i18n_auto_scoping_translate(locale, key, options)
rescue I18n::MissingTranslationData
options.delete :scope
result = i18n_auto_scoping_translate(locale, key, options)
end
result
end
end
end
|