NON_PLUGIN_FILES = FileList["{lib,bin,data}/**/*.{rb,rhtml}"] - PLUGIN_FILES
rgettext_proc = proc do |t|
require 'gettext/utils'
- plugin_files, pot_file = t.prerequisites, t.name
- GetText.rgettext(plugin_files, pot_file)
+ source_files, pot_file = t.prerequisites, t.name
+ puts "#{source_files.join(', ')} => #{pot_file}"
+ GetText.rgettext(source_files, pot_file)
end
# generate pot file for non-plugin files
# fail. we provide a wrapper to work around it. see bin/msgmerge-wrapper.rb for
# details
ENV['REAL_MSGMERGE_PATH'] = ENV['MSGMERGE_PATH']
-ENV['MSGMERGE_PATH'] = 'bin/msgmerge-wrapper.rb'
+ENV['MSGMERGE_PATH'] = ENV['MSGMERGE_WRAPPER_PATH'] || 'ruby msgmerge-wrapper.rb'
rule(%r'^po/.+/.+\.po$' => proc {|fn| fn.pathmap '%{^po/.+/,po/}X.pot'}) do |t|
require 'gettext/utils'
po_file, pot_file = t.name, t.source
+ puts "#{pot_file} => #{po_file}"
GetText.msgmerge po_file, pot_file, 'rbot'
end
# generate mo files
rule(%r'^data/locale/.+/LC_MESSAGES/.+\.mo$' => proc {|fn|
- fn.pathmap '%{^data/locale,po;LC_MESSAGES/,}X.po'
+ [ fn.pathmap('%{^data/locale,po;LC_MESSAGES/,}X.po'),
+ # the directory is created if not existing
+ fn.pathmap('%d') ]
}) do |t|
po_file, mo_file = t.source, t.name
+ puts "#{po_file} => #{mo_file}"
require 'gettext/utils'
GetText.rmsgfmt po_file, mo_file
end
PLUGIN_BASENAMES = PLUGIN_FILES.map {|f| f.pathmap('%n')}
LOCALES = FileList['po/*/'].map {|d| d.pathmap('%n')}
+LOCALES.each do |l|
+ directory "data/locale/#{l}/LC_MESSAGES"
+end
+
desc 'Update po files'
task :updatepo => LOCALES.map {|l|
["po/#{l}/rbot.po"] +