7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/transync.rb', line 7
def self.run(mode, test = nil)
FileUtils.mkdir('.transync_log') unless Dir.exist?('.transync_log')
path = TransyncConfig::CONFIG['XLIFF_FILES_PATH']
if mode == 'x2g' or mode == 'g2x'
sync = TranslationSync.new(path, mode)
sync.run(mode, test)
end
if mode == 'init'
init = Init.new(path)
init.run
end
if mode == 'test'
TransyncConfig::CONFIG['FILES'].each do |file|
SyncUtil::check_and_get_xliff_files(TransyncConfig::CONFIG['LANGUAGES'], path, file)
end
end
if mode == 'update'
TransyncConfig::CONFIG['FILES'].each do |file|
valid, _, all_translations_for_language =
SyncUtil::check_and_get_xliff_files(TransyncConfig::CONFIG['LANGUAGES'], path, file)
unless valid
xliff_trans_writer = XliffTransWriter.new(path, file)
xliff_trans_writer.write(all_translations_for_language)
end
end
p 'All xliff files should now have all the keys!'
end
end
|