Module: Ramaze::Helper::Localize

Includes:
Traited
Defined in:
lib/ramaze/helper/localize.rb

Defined Under Namespace

Classes: Dictionary, Parser

Instance Method Summary collapse

Instance Method Details

#localeObject



17
18
19
# File 'lib/ramaze/helper/localize.rb', line 17

def locale
  locales.first
end

#localesObject



21
22
23
24
25
26
27
28
# File 'lib/ramaze/helper/localize.rb', line 21

def locales
  locales = request.env['localize.locales']
  return locales if locales

  fallback = ancestral_trait[:localize_locale]
  locales = Parser.new(request).locales(fallback)
  request.env['localize.locales'] = locales
end

#localize(string, substitute = nil) ⇒ Object Also known as: l



12
13
14
# File 'lib/ramaze/helper/localize.rb', line 12

def localize(string, substitute = nil)
  localize_dictionary.translate(string, locales, substitute)
end