lib/rbbt/tsv/change_id.rb in rbbt-util-5.15.1 vs lib/rbbt/tsv/change_id.rb in rbbt-util-5.15.2
- old
+ new
@@ -87,11 +87,15 @@
end
def self.translation_index(files, target = nil, source = nil, options = {})
return nil if source == target
options = Misc.add_defaults options.dup, :persist => true
+
+ target = Entity.formats.find(target) if Entity.formats.find(target)
+ source = Entity.formats.find(source) if Entity.formats.find(source)
fields = (source and not source.empty?) ? [source] : nil
+
files.each do |file|
if TSV === file
all_fields = file.all_fields
target = file.fields.first if target.nil?
if (source.nil? or all_fields.include? source) and all_fields.include? target
@@ -124,9 +128,10 @@
if common_field and (source.nil? or source.empty? or all_fields.include? source) and other_all_fields.include? target
index = Persist.persist_tsv(nil, Misc.fingerprint(files), {:files => files, :source => source, :target => target}, :prefix => "Translation index", :persist => options[:persist]) do |data|
+ iii options.merge(:target => common_field, :fields => fields)
index = TSV === file ?
file.index(options.merge(:target => common_field, :fields => fields)) :
TSV.index(file, options.merge(:target => common_field, :fields => fields))
other_index = TSV === other_file ?