lib/aigu/ios_exporter.rb in aigu-0.4 vs lib/aigu/ios_exporter.rb in aigu-0.4.1
- old
+ new
@@ -38,28 +38,28 @@
@locale || @locale = 'en'
pattern = File.join(@input_directory, "#{@locale}.lproj", 'Localizable.strings')
filepath = Dir[pattern].first
- assign_output_from_file!(filepath)
+ assign_output_from_file!(filepath, false)
pattern = File.join(@input_directory, "#{@locale}.lproj", 'Localizable.stringsdict')
filepath = Dir[pattern].first
- assign_output_from_file!(filepath)
+ assign_output_from_file!(filepath, true)
@output
end
- def assign_output_from_file!(filepath)
+ def assign_output_from_file!(filepath, is_dict)
if filepath
puts "Processing #{filepath}"
file_content = File.open(filepath, 'rt').read
- @output.merge! parse_strings_file(file_content)
+ @output.merge! is_dict ? parse_stringsdict_file(file_content) : parse_strings_file(file_content)
else
- puts 'Strings file not found'
+ puts is_dict ? 'Stringsdict file not found' : 'Strings file not found'
end
end
def parse_strings_file(file_content)
file_content.each_line.each_with_object({}) do |line, string_hash|