Module Remarkable::I18n
In: lib/remarkable/i18n.rb

This is a wrapper for I18n default functionality.

Remarkable shouldn‘t rely on I18n default locale, because it might change throughout tests. So it‘s Remarkable responsibility to hold its own locale and send it to I18n.

Methods

add_locale   l   locale   locale=   localize   t   translate  

Public Instance methods

Add locale files to I18n and to load path, if it exists.

Examples

  Remarkable.add_locale "path/to/locale"

[Source]

    # File lib/remarkable/i18n.rb, line 16
16:     def add_locale(*locales)
17:       ::I18n.backend.load_translations *locales
18:       ::I18n.load_path += locales if ::I18n.respond_to?(:load_path)
19:     end
l(object, options = {})

Alias for localize

Get Remarkable own locale.

Examples

  Remarkable.locale = :en
  Remarkable.locale #=> :en

[Source]

    # File lib/remarkable/i18n.rb, line 38
38:     def locale
39:       @@locale
40:     end

Set Remarkable own locale.

Examples

  Remarkable.locale = :en

[Source]

    # File lib/remarkable/i18n.rb, line 27
27:     def locale=(locale)
28:       @@locale = locale
29:     end

Wrapper for I18n.localize

[Source]

    # File lib/remarkable/i18n.rb, line 51
51:     def localize(object, options = {})
52:       ::I18n.localize object, { :locale => @@locale }.merge(options)
53:     end
t(string, options = {})

Alias for translate

Wrapper for I18n.translate

[Source]

    # File lib/remarkable/i18n.rb, line 44
44:     def translate(string, options = {})
45:       ::I18n.translate string, { :locale => @@locale }.merge(options)
46:     end

[Validate]