Module: Translates::FallbacksPlugin
- Defined in:
- lib/translates/fallbacks_plugin.rb
Instance Method Summary collapse
Instance Method Details
#fallback_locales(locale) ⇒ Object
11 12 13 |
# File 'lib/translates/fallbacks_plugin.rb', line 11 def fallback_locales(locale) [locale, I18n.default_locale] end |
#present?(value) ⇒ Boolean
15 16 17 |
# File 'lib/translates/fallbacks_plugin.rb', line 15 def present?(value) !value.nil? && (value != "") end |
#read(locale) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/translates/fallbacks_plugin.rb', line 3 def read(locale) fallback_locales(locale).each do |locale| value = super(locale) return value if present?(value) end nil end |