lib/i15r.rb in i15r-0.5.0 vs lib/i15r.rb in i15r-0.5.1
- old
+ new
@@ -63,29 +63,20 @@
@printer.println("")
i18ned_text = sub_plain_strings(text, prefix, template_type.to_sym)
@writer.write(path, i18ned_text) unless config.dry_run?
end
- def display_indented_header(prefix)
- puts "en:"
- prefix_parts = prefix.split(".").each_with_index do |p, i|
- p = "#{p}:"
- #TODO: perhaps " "*i is simpler
- (0..i).each { |i| p = " " + p }
- puts "#{p}"
- end
- end
-
def sub_plain_strings(text, prefix, file_type)
pm = I15R::PatternMatcher.new(prefix, file_type, :add_default => config.add_default)
transformed_text = pm.run(text) do |old_line, new_line|
@printer.print_diff(old_line, new_line)
end
transformed_text + "\n"
end
def internationalize!(path)
- #TODO: Indicate if we're running in dry-run mode
+ @printer.println "Running in dry-run mode" if config.dry_run?
+ path = "app" if path.nil?
files = File.directory?(path) ? Dir.glob("#{path}/**/*.{erb,haml}") : [path]
files.each { |file| internationalize_file(file) }
end
end