Commit 7fc088dd3c7a150831348cd3efbfdbfb14105b85

Authored by Antonio Terceiro
1 parent bd5ecbc3

Unifying message catalogs after extraction

For some reason the extraction is producing duplicate entries, wich cause
msgmerge to exit with an error and not doing the merge.

This commit adds a monkey patch on GetText and will probably break in the
future.
Showing 1 changed file with 11 additions and 0 deletions   Show diff stats
lib/tasks/gettext.rake
... ... @@ -16,6 +16,17 @@ task :updatepo do
16 16 GetText::RubyParser::ID << '__'
17 17 GetText::RubyParser::PLURAL_ID << 'n__'
18 18 GetText::ActiveRecordParser.init(:use_classname => false)
  19 +
  20 + module GetText
  21 + module_function
  22 + def update_pofiles(textdomain, files, app_version, po_root = "po", refpot = "tmp.pot")
  23 + rgettext(files, refpot)
  24 + system("mv tmp.pot tmp2.pot; msguniq -o tmp.pot tmp2.pot; rm -f tmp2.pot")
  25 + msgmerge_all(textdomain, app_version, po_root, refpot)
  26 + File.delete(refpot)
  27 + end
  28 + end
  29 +
19 30 GetText.update_pofiles(Noosfero::PROJECT, Dir.glob("{app,lib}/**/*.{rb,rhtml}") + Dir.glob('public/*.html.erb'),
20 31 "#{Noosfero::PROJECT} #{Noosfero::VERSION}")
21 32 end
... ...