Class: Globalize::Backend::Static
- Inherits:
-
Pluralizing
- Object
- I18n::Backend::Simple
- Pluralizing
- Globalize::Backend::Static
- Defined in:
- lib/globalize/backend/static.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Static
constructor
A new instance of Static.
- #orig_interpolate ⇒ Object
- #translate(locale, key, options = {}) ⇒ Object
Methods inherited from Pluralizing
#add_pluralizer, #pluralize, #pluralizer
Constructor Details
#initialize(*args) ⇒ Static
Returns a new instance of Static.
8 9 10 |
# File 'lib/globalize/backend/static.rb', line 8 def initialize(*args) add(*args) unless args.empty? end |
Instance Method Details
#orig_interpolate ⇒ Object
28 |
# File 'lib/globalize/backend/static.rb', line 28 alias :orig_interpolate :interpolate |
#translate(locale, key, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/globalize/backend/static.rb', line 12 def translate(locale, key, = {}) result, default, fallback = nil, .delete(:default), nil I18n.fallbacks[locale].each do |fallback| begin result = super(fallback, key, ) and break rescue I18n::MissingTranslationData end end result ||= default locale, default, attrs = {:requested_locale => locale, :locale => fallback, :key => key, :options => } translation(result, attrs) || raise(I18n::MissingTranslationData.new(locale, key, )) end |