Class: Bovem::Localizer

Inherits:
Lazier::Localizer
  • Object
show all
Defined in:
lib/bovem/localizer.rb

Overview

This class is used to localize strings inside classes methods.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Localizer) initialize(locale)

Initialize a new localizer.

Parameters:

  • locale (String|Symbol)

    The locale to use for localization.



13
14
15
# File 'lib/bovem/localizer.rb', line 13

def initialize(locale)
  super("bovem.application", ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/"), locale)
end

Class Method Details

+ (String|R18n::Untranslated) localize_on_locale(locale, message, *args)

Localize a message in a specified locale.

Parameters:

  • locale (String|Symbol)

    The locale to use for localization.

  • message (String|Symbol)

    The message to localize.

  • args (Array)

    Optional arguments to localize the message.

Returns:

  • (String|R18n::Untranslated)

    The localized message.



23
24
25
# File 'lib/bovem/localizer.rb', line 23

def self.localize_on_locale(locale, message, *args)
  new(locale).i18n.send(message, *args)
end