From 7fc088dd3c7a150831348cd3efbfdbfb14105b85 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Fri, 4 Dec 2009 08:48:03 -0300 Subject: [PATCH] Unifying message catalogs after extraction --- lib/tasks/gettext.rake | 11 +++++++++++ 1 file changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index 42d6e5b..8995a8d 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -16,6 +16,17 @@ task :updatepo do GetText::RubyParser::ID << '__' GetText::RubyParser::PLURAL_ID << 'n__' GetText::ActiveRecordParser.init(:use_classname => false) + + module GetText + module_function + def update_pofiles(textdomain, files, app_version, po_root = "po", refpot = "tmp.pot") + rgettext(files, refpot) + system("mv tmp.pot tmp2.pot; msguniq -o tmp.pot tmp2.pot; rm -f tmp2.pot") + msgmerge_all(textdomain, app_version, po_root, refpot) + File.delete(refpot) + end + end + GetText.update_pofiles(Noosfero::PROJECT, Dir.glob("{app,lib}/**/*.{rb,rhtml}") + Dir.glob('public/*.html.erb'), "#{Noosfero::PROJECT} #{Noosfero::VERSION}") end -- libgit2 0.21.2