Skip to content

Commit

Permalink
Added support for android styled text using getText()
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob committed Oct 16, 2019
1 parent a0a9e58 commit 0df360a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ios-strings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,20 @@ def import_android(import_path)
xml = File.read xml_path.to_s
doc = REXML::Document.new(xml)

xml_formatter = REXML::Formatters::Default.new()
doc.elements.each('resources/string') { |str|
next if str.attributes['translatable'] == 'false' and $skip_untranslatable_strings

key = str.attributes['name']
# puts "string: #{key}"

until not str.has_elements?
str.each_element { |astr|
str = astr
}
end
out_str = ""
str.each { |child|
xml_formatter.write(child, out_str)
}

next if not str.text
$strings_keys[key] = true
values[:strings][key] = import_android_string(str.text)
values[:strings][key] = import_android_string(out_str)
}

doc.elements.each('resources/string-array') { |arr|
Expand Down

0 comments on commit 0df360a

Please sign in to comment.