Class: Mamertes::Localizer

Inherits:
Lazier::Localizer
  • Object
show all
Defined in:
lib/mamertes/application.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.



41
42
43
# File 'lib/mamertes/application.rb', line 41

def initialize(locale)
  super(:mamertes, ::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.



51
52
53
# File 'lib/mamertes/application.rb', line 51

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