Class: Vldt::I18n
- Inherits:
-
Object
- Object
- Vldt::I18n
- Defined in:
- lib/vldt/i18n.rb
Overview
i18n integration for vldt
Constant Summary collapse
- I18N_OPTIONS =
Default options for the t call
{ default: false, exception_handler: -> (*args) { false } }
Class Method Summary collapse
-
.t(result, namespace: nil) ⇒ Object
Add translated error messages to the errors.
Class Method Details
.t(result, namespace: nil) ⇒ Object
Add translated error messages to the errors.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vldt/i18n.rb', line 28 def self.t (result, namespace: nil) = result.map do |selector, errors| new_errors = errors.map do |error| e = error.dup = I18N_OPTIONS.merge(e[:params]) scopes(selector, namespace).each do |scope| [:scope] = scope = ::I18n.t(e[:type], ) if e[:message] = break end end e end [selector, new_errors] end ::Hash[] end |