Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/babelish/csv2android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def process_value(row_value, default_value)
end

def get_row_format(row_key, row_value, comment = nil, indentation = 0)
"\t<string name=\"#{row_key}\">#{row_value}</string>\n"
entry = comment.to_s.empty? ? "" : "\n<!-- #{comment} -->\n"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 (not 4) spaces for indentation.

entry + "\t<string name=\"#{row_key}\">#{row_value}</string>\n"
end

def hash_to_output(content = {})
Expand All @@ -34,7 +35,8 @@ def hash_to_output(content = {})
output += "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
output += "<resources>\n"
content.each do |key, value|
output += get_row_format(key, value)
comment = @comments[key]
output += get_row_format(key, value, comment)
end
output += "</resources>\n"
end
Expand Down