4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/localeapp/default_value_handler.rb', line 4
def default(locale, object, subject, options = {})
result = default_without_handler(locale, object, subject, options)
original_object = object
object ||= Thread.current[:i18n_default_object]
case subject when String
value = locale.to_s == I18n.default_locale.to_s ? subject : nil
Localeapp.missing_translations.add(locale, object, value, options)
when Array
text_default = subject.detect{|item| item.is_a? String }
if text_default
value = locale.to_s == I18n.default_locale.to_s ? text_default : nil
Localeapp.missing_translations.add(locale, object, value, options)
end
when Symbol
end
Thread.current[:i18n_default_object] = original_object
return result
end
|