Method: IsoDoc::PresentationXMLConvert#i8n_name1

Defined in:
lib/isodoc/presentation_function/metadata.rb

#i8n_name1(hash, pref) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/isodoc/presentation_function/metadata.rb', line 106

def i8n_name1(hash, pref)
  hash.reject { |_k, v| blank?(v) }.each_with_object([]) do |(k, v), g|
    case v
    when Hash then i8n_name(v, i18n_safe(k)).each { |x| g << x }
    when Array
      v.reject { |a| blank?(a) }.each_with_index do |v1, i|
        i8n_name(v1, "#{i18n_safe(k)}.#{i}").each { |x| g << x }
      end
    else
      g << i18n_tag("#{pref}#{pref.empty? ? '' : '.'}#{i18n_safe(k)}", v)
    end
  end
end