class I18n::Config

Defined in:

i18n/config.cr

Instance Method Summary

Instance Method Detail

def available_locales : Array(String) #

Returns the available locales


[View source]
def backend #

Returns the current backend.


[View source]
def backend=(backend : I18n::Backend::Base | Nil) #

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


[View source]
def default_locale #

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


[View source]
def default_locale=(new_default : String) #

[View source]
def default_separator #

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


[View source]
def default_separator=(separator : Char | Nil) #

Sets the current default scope separator.


[View source]
def exception_handler #

Returns the current exception handler. Defaults to an instance of I18n::ExceptionHandler.


[View source]
def exception_handler=(exception_handler : Nil | I18n::ExceptionHandler) #

Sets the exception handler.


[View source]
def load_path #

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'


[View source]
def load_path=(load_path : Nil | Array(String)) #

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


[View source]
def locale #

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


[View source]
def locale=(locale : Nil | String) #

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


[View source]