Commit 9268c163a9b99d73f643d3dd9f30384a41ba3c4b

Authored by Antonio Terceiro
1 parent 1ceb891e

Allow translations that miss online documentation

Without this, `rake noosfero:doc:translate` will always fail if there is
any language $lang without a corresponding po/$lang/noosfero-doc.po.
Let's face, translating the documentation in the last thing one will do
when creating a translation.
Showing 1 changed file with 1 additions and 3 deletions   Show diff stats
lib/tasks/doc.rake
@@ -123,9 +123,7 @@ namespace :noosfero do @@ -123,9 +123,7 @@ namespace :noosfero do
123 task :rebuild => [:clean, :build] 123 task :rebuild => [:clean, :build]
124 124
125 def percent_translated(po_file) 125 def percent_translated(po_file)
126 - if !File.exists?(po_file)  
127 - raise "#{po_file}: not found"  
128 - end 126 + return 0 unless File.exists?(po_file)
129 output = `LANG=C msgfmt --output /dev/null --statistics #{po_file} 2>&1` 127 output = `LANG=C msgfmt --output /dev/null --statistics #{po_file} 2>&1`
130 puts output 128 puts output
131 translated = (output =~ /([0-9]+) translated messages/) ? $1.to_i : 0 129 translated = (output =~ /([0-9]+) translated messages/) ? $1.to_i : 0