diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-02-02 14:41:30 +0000 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-02-02 14:41:30 +0000 |
commit | 9cb73757009dab8c71c9a374c935cd50fa38094f (patch) | |
tree | 89c59357b714447d69b2b226c722f95333cfadde | |
parent | 53d249b2c500dae07e934c0009d0813181092702 (diff) |
New improved find-msgids-and-make-pot-file rake task:
(a) it doesn't do fuzzy matches (apparently Transifex does that for you)
(b) it doesn't update all the PO files too (which certainly Transifex does for you)
-rw-r--r-- | lib/tasks/gettext.rake | 20 | ||||
-rwxr-xr-x | script/generate_pot.sh | 5 |
2 files changed, 21 insertions, 4 deletions
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index 017e7c837..8ffd5ce1b 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -1,5 +1,23 @@ namespace :gettext do + + desc "Update pot file only, without fuzzy guesses (these are done by Transifex)" + task :findpot => :environment do + load_gettext + $LOAD_PATH << File.join(File.dirname(__FILE__),'..','..','lib') + require 'gettext_i18n_rails/haml_parser' + files = files_to_translate + + #write found messages to tmp.pot + temp_pot = "tmp.pot" + GetText::rgettext(files, temp_pot) + + #merge tmp.pot and existing pot + FileUtils.mkdir_p('locale') + GetText::msgmerge("locale/app.pot", temp_pot, "version 0.0.1", :po_root => 'locale', :msgmerge=>[ :no_fuzzy_matching, :sort_output ]) + File.delete(temp_pot) + end + def files_to_translate Dir.glob("{app,lib,config,locale}/**/*.{rb,erb,haml,rhtml}") end -end
\ No newline at end of file +end diff --git a/script/generate_pot.sh b/script/generate_pot.sh index 1ca361d08..0c5dfda36 100755 --- a/script/generate_pot.sh +++ b/script/generate_pot.sh @@ -3,7 +3,6 @@ cd `dirname $0` rake gettext:store_model_attributes -rake gettext:find -git checkout ../locale/*/app.po +rake gettext:findpot -echo "Now commit the new app.pot and push. See TRANSLATE.md for more info"
\ No newline at end of file +echo "Now commit the new app.pot and push. See TRANSLATE.md for next steps"
\ No newline at end of file |