Method: Babelyoda::LocalizationKey#to_strings

Defined in:
lib/babelyoda/strings.rb

#to_strings(io, language) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/babelyoda/strings.rb', line 21

def to_strings(io, language)
  return if self.values[language].nil?
  io << "/* #{self.context} */\n" if self.context
  if plural?
    values[language].text.keys.sort.each do |plural_key|
      if values[language].text[plural_key] != nil && values[language].text[plural_key].length > 0
        io << "\"#{pluralize_key(id, plural_key).escape_double_quotes}\" = \"#{values[language].text[plural_key].escape_double_quotes}\";\n"
      end
    end
  else
    io << "\"#{id.escape_double_quotes}\" = \"#{values[language].text.escape_double_quotes}\";\n"
  end
  io << "\n"
end