Object
Returns an array of locales for which translations are available. Unless you explicitely set these through I18n.available_locales= the call will be delegated to the backend.
# File lib/i18n/config.rb, line 37
37: def available_locales
38: @@available_locales ||= nil
39: @@available_locales || backend.available_locales
40: end
Sets the available locales.
# File lib/i18n/config.rb, line 43
43: def available_locales=(locales)
44: @@available_locales = Array(locales).map { |locale| locale.to_sym }
45: @@available_locales = nil if @@available_locales.empty?
46: end
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
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
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
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
Returns the current default scope separator. Defaults to ’.’
# File lib/i18n/config.rb, line 49
49: def default_separator
50: @@default_separator ||= '.'
51: end
Sets the current default scope separator.
# File lib/i18n/config.rb, line 54
54: def default_separator=(separator)
55: @@default_separator = separator
56: end
Return the current exception handler. Defaults to :default_exception_handler.
# File lib/i18n/config.rb, line 59
59: def exception_handler
60: @@exception_handler ||= ExceptionHandler.new
61: end
Sets the exception handler.
# File lib/i18n/config.rb, line 64
64: def exception_handler=(exception_handler)
65: @@exception_handler = exception_handler
66: end
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 76
76: def load_path
77: @@load_path ||= []
78: end
Sets the load path instance. Custom implementations are expected to behave like a Ruby Array.
# File lib/i18n/config.rb, line 82
82: def load_path=(load_path)
83: @@load_path = load_path
84: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.