Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/merb_global/base.rb

Instance Method Summary collapse

Instance Method Details

#localize(opts = {}) ⇒ Object

call-seq:

localize => localized string

Translate the string withing the current locales by default.

Parameters

opts<Hash>

Options of translations

Options (opts)

locale<Locale>

The translation in other locale

n<Fixnum>

A number of objects. Please note that it should be used with plural

plural<String>

Plural form



22
23
24
25
26
27
# File 'lib/merb_global/base.rb', line 22

def localize(opts = {})
  _opts = {:locale => Merb::Global::Locale.current, :n => 1, :plural => nil}
  _opts.merge!(opts)
  Merb::Global::MessageProviders.provider.localize self, _opts[:plural],
                                                   _opts[:n], _opts[:locale]
end