diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb index eabef60..bbcf5c7 100644 --- a/lib/twine/formatters/android.rb +++ b/lib/twine/formatters/android.rb @@ -108,21 +108,25 @@ module Twine end def format_section_header(section) - "\t" + "#{space(4)}" end def format_comment(definition, lang) - "\t\n" if definition.comment + "#{space(4)}\n" if definition.comment end def key_value_pattern - "\t%{value}" + "#{space(4)}%{value}" end def format_plural_keys(key, plural_hash) - result = "\t\n" - result += plural_hash.map{|quantity,value| "\t#{' ' * 2}#{escape_value(value)}"}.join("\n") - result += "\n\t" + result = "#{space(4)}\n" + result += plural_hash.map{|quantity,value| "#{space(8)}#{escape_value(value)}"}.join("\n") + result += "\n#{space(4)}" + end + + def space(level) + ' ' * level end def gsub_unless(text, pattern, replacement) diff --git a/test/fixtures/formatter_android.xml b/test/fixtures/formatter_android.xml index fe7d15f..7fcb655 100644 --- a/test/fixtures/formatter_android.xml +++ b/test/fixtures/formatter_android.xml @@ -1,12 +1,12 @@ - - - value1-english - value2-english + + + value1-english + value2-english - - value3-english - - value4-english + + value3-english + + value4-english