module R18n::Rails::Helpers
Public Instance Methods
l(obj, *args, **kwargs)
click to toggle source
Extend `l` helper to use also R18n
syntax.
l Time.now # Rails I18n default format l Time.now, format: :short # Rails I18n style l Time.now, :human # R18n style
Calls superclass method
# File lib/r18n-rails/helpers.rb, line 51 def l(obj, *args, **kwargs) if args.empty? || kwargs.any? super(obj, *args, **kwargs) else r18n.l(obj, *args, now: Time.zone.now, **kwargs) end end
Also aliased as: localize
r18n()
click to toggle source
Return current R18n
I18n object, to use R18n
API:
-
`r18n.available_locales` – available application translations.
-
`r18n.locales` – List of user locales
-
`r18n.reload!` – Reload
R18n
translations
You can get translations by `r18n.user.name`, but `t` helper is more beautiful, short and also support R18n
syntax.
# File lib/r18n-rails/helpers.rb, line 29 def r18n R18n.get end