Class: Lazier::Localizer
- Inherits:
-
Object
- Object
- Lazier::Localizer
- Includes:
- I18n
- Defined in:
- lib/lazier/localizer.rb
Overview
A utility class to localize messages
Instance Attribute Summary
Attributes included from I18n
#i18n_locale, #i18n_locales_path, #i18n_root
Class Method Summary (collapse)
-
+ (String|R18n::Untranslated) localize(message, *args)
Localize a message.
-
+ (String|R18n::Untranslated) localize_on_locale(locale, message, *args)
Localize a message in a specified locale.
Instance Method Summary (collapse)
-
- (Localizer) initialize(root = nil, path = nil, locale = nil)
constructor
Initialize a new localizer.
Methods included from I18n
Constructor Details
- (Localizer) initialize(root = nil, path = nil, locale = nil)
Initialize a new localizer.
17 18 19 20 |
# File 'lib/lazier/localizer.rb', line 17 def initialize(root = nil, path = nil, locale = nil) i18n_setup(root || :lazier, path || ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) self.i18n = locale end |
Class Method Details
+ (String|R18n::Untranslated) localize(message, *args)
Localize a message.
27 28 29 |
# File 'lib/lazier/localizer.rb', line 27 def self.localize(, *args) new.i18n.send(, *args) end |
+ (String|R18n::Untranslated) localize_on_locale(locale, message, *args)
Localize a message in a specified locale.
37 38 39 |
# File 'lib/lazier/localizer.rb', line 37 def self.localize_on_locale(locale, , *args) new(nil, nil, locale).i18n.send(, *args) end |