Module: Polish::Proxies
- Included in:
- Polish
- Defined in:
- lib/polish/proxies.rb
Instance Method Summary collapse
-
#localize(object, options = {}) ⇒ Object
(also: #l)
See I18n::localize.
-
#pluralize(n, *variants) ⇒ Object
(also: #p)
Simple pluralization proxy.
-
#strftime(object, format = :default) ⇒ Object
strftime() proxy with Polish localization.
-
#translate(key, options = {}) ⇒ Object
(also: #t)
See I18n::translate.
Instance Method Details
#localize(object, options = {}) ⇒ Object Also known as: l
See I18n::localize
10 11 12 |
# File 'lib/polish/proxies.rb', line 10 def localize(object, = {}) I18n.localize(object, .merge({ :locale => LOCALE })) end |
#pluralize(n, *variants) ⇒ Object Also known as: p
24 25 26 27 28 29 |
# File 'lib/polish/proxies.rb', line 24 def pluralize(n, *variants) raise ArgumentError, "Must have a Numeric as a first parameter" unless n.is_a?(Numeric) raise ArgumentError, "Must have 3 variants for pluralization" if variants.size < 3 variants_hash = pluralization_variants_to_hash(*variants) I18n.backend.send(:pluralize, LOCALE, variants_hash, n) end |
#strftime(object, format = :default) ⇒ Object
strftime() proxy with Polish localization
16 17 18 |
# File 'lib/polish/proxies.rb', line 16 def strftime(object, format = :default) localize(object, { :format => format }) end |
#translate(key, options = {}) ⇒ Object Also known as: t
See I18n::translate
4 5 6 |
# File 'lib/polish/proxies.rb', line 4 def translate(key, = {}) I18n.translate(key, .merge({ :locale => LOCALE })) end |