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
21
22
23
|
# 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) ⇒ Object
9
10
11
12
|
# 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 ⇒ 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
14
15
16
17
18
19
|
# 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
|