Module: Ramaze::Helper::Localize

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

Overview

The localization helper can be used to output translated strings. This enables your application to use multiple language files for English, Dutch and so on.

Defined Under Namespace

Classes: Dictionary, Parser

Instance Method Summary (collapse)

Instance Method Details

- (Object) locale



22
23
24
# File 'lib/ramaze/helper/localize.rb', line 22

def locale
  locales.first
end

- (Object) locales



26
27
28
29
30
31
32
33
# File 'lib/ramaze/helper/localize.rb', line 26

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

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



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

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