lib/transync/sync/sync_util.rb in transync-0.0.1 vs lib/transync/sync/sync_util.rb in transync-0.1.0
- old
+ new
@@ -1,20 +1,24 @@
require_relative '../xliff_trans/xliff_trans_reader'
module SyncUtil
- def check_and_get_xliff_files(languages, path, file)
+ def self.check_and_get_xliff_files(languages, path, file, create = false)
xliff_translations = []
+ added = false
languages.each do |language|
xliff_reader = XliffTransReader.new(path, file, language, languages)
- if xliff_reader.valid?
+ if xliff_reader.valid?(create)
xliff_translations << xliff_reader.get_translations
else
- abort('Fix your Xliff translations first!')
+ added = true if create
+ abort('Fix your Xliff translations first!') unless create
end
end
+ p 'Missing translations were added!' if create and added
+
xliff_translations
end
-end
\ No newline at end of file
+end