12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/i18n-js-assets/processor.rb', line 12
def evaluate(scope, locals)
options = (YAML.load(data) || {}).with_indifferent_access
only = options.fetch(:only, '*')
exceptions = [options.fetch(:except, [])].flatten
translations = if i18n_js.method(:segment_for_scope).arity == 2
i18n_js.segment_for_scope(only, exceptions)
else
i18n_js.segment_for_scope(only)
end
locales = options.fetch(:locales, translations.keys).map(&:to_sym)
construct_javascript_from(locales, translations)
end
|