lib/aigu/ios_importer.rb in aigu-0.4 vs lib/aigu/ios_importer.rb in aigu-0.4.1
- old
+ new
@@ -70,19 +70,21 @@
file_content
end
# This takes a string and replaces iOS interpolations to Android interpolations
# so that it is reusable across platforms.
- # Example: 'iOS interpolation %@ or %1$@' => 'Android interpolation %s or %1$s'.
+ # Example: 'iOS interpolation %s or %1$s' => 'Android interpolation %@ or %1$@'.
def replace_string_interpolations(string)
- string.gsub(/%([0-9]+\$)?@/, '%\\1s')
+ string.gsub(/%([0-9]+\$)?s/, '%\\1@')
end
def write_stringsdict_file(content)
# uses same logic as exporter to parse current file & update in memory
# read file
file_path = File.join(@output_directory, "#{@locale}.lproj", 'Localizable.stringsdict')
+ return unless File.exist? file_path
+
puts "Updating #{file_path}"
file_content = File.open(file_path, 'rb:bom|utf-8').read
# in memory update