Parent

I18n::Config

Public Instance Methods

available_locales() click to toggle source

Returns an array of locales for which translations are available. Unless you explicitely set the these through I18n.available_locales= the call will be delegated to the backend and memoized on the I18n module.

    # File lib/i18n/config.rb, line 37
37:     def available_locales
38:       @@available_locales ||= backend.available_locales
39:     end
available_locales=(locales) click to toggle source

Sets the available locales.

    # File lib/i18n/config.rb, line 42
42:     def available_locales=(locales)
43:       @@available_locales = locales
44:     end
backend() click to toggle source

Returns the current backend. Defaults to +Backend::Simple+.

    # File lib/i18n/config.rb, line 15
15:     def backend
16:       @@backend ||= Backend::Simple.new
17:     end
backend=(backend) click to toggle source

Sets the current backend. Used to set a custom backend.

    # File lib/i18n/config.rb, line 20
20:     def backend=(backend)
21:       @@backend = backend
22:     end
default_locale() click to toggle source

Returns the current default locale. Defaults to :’en’

    # File lib/i18n/config.rb, line 25
25:     def default_locale
26:       @@default_locale ||= :en
27:     end
default_locale=(locale) click to toggle source

Sets the current default locale. Used to set a custom default locale.

    # File lib/i18n/config.rb, line 30
30:     def default_locale=(locale)
31:       @@default_locale = locale.to_sym rescue nil
32:     end
default_separator() click to toggle source

Returns the current default scope separator. Defaults to ’.’

    # File lib/i18n/config.rb, line 47
47:     def default_separator
48:       @@default_separator ||= '.'
49:     end
default_separator=(separator) click to toggle source

Sets the current default scope separator.

    # File lib/i18n/config.rb, line 52
52:     def default_separator=(separator)
53:       @@default_separator = separator
54:     end
exception_handler() click to toggle source

Return the current exception handler. Defaults to :default_exception_handler.

    # File lib/i18n/config.rb, line 57
57:     def exception_handler
58:       @@exception_handler ||= :default_exception_handler
59:     end
exception_handler=(exception_handler) click to toggle source

Sets the exception handler.

    # File lib/i18n/config.rb, line 62
62:     def exception_handler=(exception_handler)
63:       @@exception_handler = exception_handler
64:     end
load_path() click to toggle source

Allow clients to register paths providing translation data sources. The backend defines acceptable sources.

E.g. the provided SimpleBackend accepts a list of paths to translation files which are either named *.rb and contain plain Ruby Hashes or are named *.yml and contain YAML data. So for the SimpleBackend clients may register translation files like this:

  I18n.load_path << 'path/to/locale/en.yml'
    # File lib/i18n/config.rb, line 74
74:     def load_path
75:       @@load_path ||= []
76:     end
load_path=(load_path) click to toggle source

Sets the load path instance. Custom implementations are expected to behave like a Ruby Array.

    # File lib/i18n/config.rb, line 80
80:     def load_path=(load_path)
81:       @@load_path = load_path
82:     end
locale() click to toggle source

The only configuration value that is not global and scoped to thread is :locale. It defaults to the default_locale.

   # File lib/i18n/config.rb, line 5
5:     def locale
6:       @locale ||= default_locale
7:     end
locale=(locale) click to toggle source

Sets the current locale pseudo-globally, i.e. in the Thread.current hash.

    # File lib/i18n/config.rb, line 10
10:     def locale=(locale)
11:       @locale = locale.to_sym rescue nil
12:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.