class Locraft::XMLStringsGenerator

Public Instance Methods

broadcast_file_generation(f) click to toggle source
# File lib/locraft/generators/xml_strings_generator.rb, line 21
def broadcast_file_generation(f)
  puts "xml strings file generated: [#{f}]"
end
destination_dir_for(lang, lang_code) click to toggle source
# File lib/locraft/generators/xml_strings_generator.rb, line 9
def destination_dir_for(lang, lang_code)
  comp = @config.default_lang == lang ? 'values' : "values-#{lang_code}"
  "#{@config.relative_strings_destination}/#{comp}"
end
file_template() click to toggle source
# File lib/locraft/generators/xml_strings_generator.rb, line 5
def file_template
  Utils.resource_file('xml_strings_template.txt')
end
strings_line_with(localization) click to toggle source
# File lib/locraft/generators/xml_strings_generator.rb, line 14
def strings_line_with(localization)
  xml_value = localization.strict_value.gsub('%@', '%s')
  xml_value.gsub!("'", "\\\\'")
  xml_value.gsub!('&', '&')
  %(<string name="#{localization.key}">#{xml_value}</string>\n)
end