Reputation: 756
I18n.localize has the signature:
- (Object) localize(locale, object, format = :default, options = {})
What is the options parameter used for?
Neither of these sources seem to have it documented: http://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-localize http://www.rubydoc.info/github/svenfuchs/i18n/master/I18n/Backend/Base:localize
Upvotes: 1
Views: 721
Reputation: 2558
From sources:
def localize(locale, object, format = :default, options = {})
...
if Symbol === format
...
options = options.merge(:raise => true, :object => object, :locale => locale)
format = I18n.t(:#{type}.formats.#{key}", options)
end
...
end
Thus, all these options are passed to I18n.t call that generates format. For example, it can be default
option whose value will be returned if the format's translation is missing.
Upvotes: 1