Module: I18n::Processes::Command::Commands::Missing
Instance Method Summary
collapse
#keys_source, #origin_file_read, #preprocessing
included
Instance Method Details
#missing(opt = {}) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/i18n/processes/command/commands/missing.rb', line 30
def missing(opt = {})
translated_locales = opt[:locales].reject{|x| x == base_locale}
translated_locales.each do |locale|
$stderr.puts Rainbow("#{base_locale} to #{locale}\n").green
preprocessing({:locales => [locale] })
changed_keys(locale)
missing_keys = spreadsheet_report.find_missing(locale)
missing_count = missing_keys.count
if missing_count.zero?
spreadsheet_report.translated_files(locale)
spreadsheet_report.origin_dic(locale)
else
$stderr.puts Rainbow("#{missing_count} keys need to be translated to #{locale}").red.bright
spreadsheet_report.missing_report(locale)
end
end
end
|
#translate_missing(opt = {}) ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/i18n/processes/command/commands/missing.rb', line 53
def translate_missing(opt = {})
missing = i18n.missing_diff_forest opt[:locales], opt[:from]
translated = i18n.google_translate_forest missing, opt[:from]
i18n.data.merge! translated
log_stderr "Translated #{translated.leaves.count} keys"
print_forest translated, opt
end
|