Module: Remarkable::I18n

Included in:
Remarkable
Defined in:
lib/remarkable/i18n.rb

Instance Method Summary collapse

Instance Method Details

#add_locale(*locales) ⇒ Object

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



6
7
8
9
# File 'lib/remarkable/i18n.rb', line 6

def add_locale(*locales)
  ::I18n.backend.load_translations *locales
  ::I18n.load_path += locales if ::I18n.respond_to?(:load_path)
end

#localeObject

Get Remarkable locale (which is not necessarily the same as the application)



17
18
19
# File 'lib/remarkable/i18n.rb', line 17

def locale
  @@locale
end

#locale=(locale) ⇒ Object

Set Remarkable locale (which is not necessarily the same as the application)



12
13
14
# File 'lib/remarkable/i18n.rb', line 12

def locale=(locale)
  @@locale = locale
end

#localize(object, options = {}) ⇒ Object Also known as: l

Wrapper for localization



28
29
30
# File 'lib/remarkable/i18n.rb', line 28

def localize(object, options = {})
  ::I18n.localize object, { :locale => @@locale }.merge(options)
end

#translate(string, options = {}) ⇒ Object Also known as: t

Wrapper for translation



22
23
24
# File 'lib/remarkable/i18n.rb', line 22

def translate(string, options = {})
  ::I18n.translate string, { :locale => @@locale }.merge(options)
end