Commit d383cc6f09a9472da3152372c778c30c54a9cec1
1 parent
8a197dbb
Exists in
master
and in
29 other branches
add per-language checkpo:$lang task
Showing
1 changed file
with
18 additions
and
1 deletions
Show diff stats
lib/tasks/gettext.rake
@@ -106,8 +106,25 @@ Dir.glob('plugins/*').each do |plugindir| | @@ -106,8 +106,25 @@ Dir.glob('plugins/*').each do |plugindir| | ||
106 | end | 106 | end |
107 | end | 107 | end |
108 | 108 | ||
109 | +def checkpo(po_files) | ||
110 | + max = po_files.map(&:size).max | ||
111 | + po_files.each do |po| | ||
112 | + printf "%#{max}s: ", po | ||
113 | + system "msgfmt --statistics --output /dev/null " + po | ||
114 | + end | ||
115 | +end | ||
116 | + | ||
117 | +desc "checks core translation files" | ||
109 | task :checkpo do | 118 | task :checkpo do |
110 | - sh 'for po in po/*/noosfero.po; do echo -n "$po: "; msgfmt --statistics --output /dev/null $po; done' | 119 | + checkpo(Dir.glob('po/*/noosfero.po')) |
120 | +end | ||
121 | + | ||
122 | +languages = Dir.glob('po/*').select { |d| File.directory?(d) }.map { |d| File.basename(d) } | ||
123 | +languages.each do |lang| | ||
124 | + desc "checks #{lang} translation files" | ||
125 | + task "checkpo:#{lang}" do | ||
126 | + checkpo(Dir.glob("po/#{lang}/*.po") + Dir.glob("plugins/*/po/#{lang}/*.po")) | ||
127 | + end | ||
111 | end | 128 | end |
112 | 129 | ||
113 | # vim: ft=ruby | 130 | # vim: ft=ruby |