From d383cc6f09a9472da3152372c778c30c54a9cec1 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 6 Aug 2015 17:36:28 -0300 Subject: [PATCH] add per-language checkpo:$lang task --- lib/tasks/gettext.rake | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index 1ad1492..86f2375 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -106,8 +106,25 @@ Dir.glob('plugins/*').each do |plugindir| end end +def checkpo(po_files) + max = po_files.map(&:size).max + po_files.each do |po| + printf "%#{max}s: ", po + system "msgfmt --statistics --output /dev/null " + po + end +end + +desc "checks core translation files" task :checkpo do - sh 'for po in po/*/noosfero.po; do echo -n "$po: "; msgfmt --statistics --output /dev/null $po; done' + checkpo(Dir.glob('po/*/noosfero.po')) +end + +languages = Dir.glob('po/*').select { |d| File.directory?(d) }.map { |d| File.basename(d) } +languages.each do |lang| + desc "checks #{lang} translation files" + task "checkpo:#{lang}" do + checkpo(Dir.glob("po/#{lang}/*.po") + Dir.glob("plugins/*/po/#{lang}/*.po")) + end end # vim: ft=ruby -- libgit2 0.21.2