Class: Locraft::XMLStringsGenerator
Instance Method Summary
collapse
#generate, #strings_file, #strings_file_content, #valid?, #valid_localization?
Methods inherited from Generator
#generate, #initialize, #valid?
Instance Method Details
#broadcast_file_generation(f) ⇒ Object
20
21
22
|
# File 'lib/locraft/generators/xml_strings_generator.rb', line 20
def broadcast_file_generation(f)
puts "xml strings file generated: [#{f}]"
end
|
#destination_dir_for(lang) ⇒ Object
9
10
11
|
# File 'lib/locraft/generators/xml_strings_generator.rb', line 9
def destination_dir_for(lang)
"#{@config.relative_strings_destination}/values-#{lang}"
end
|
#file_template ⇒ Object
5
6
7
|
# 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) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/locraft/generators/xml_strings_generator.rb', line 13
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
|