Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

If the translation field in the database is not NULL the _() method t…

…hink the string is translated, and return a blank string instead if the fallback msgid. Setting the msgstr to nil make sure that we get NULL values in the db which we want.
  • Loading branch information...
1 parent 2b2d632 commit 5c309f36d21a07ba4a19380a4077e44cbab0a172 hankthetank committed
Showing with 3 additions and 0 deletions.
  1. +3 −0  lib/tasks/sync_po_to_db.rake
3  lib/tasks/sync_po_to_db.rake
@@ -30,6 +30,9 @@ task :sync_po_to_db => :environment do
next if key.translations.detect{|text| text.locale == locale}
#store translations
+ # make sure we store nil (NULL) values if msgstr is blank
+ # so that the _() method will see that the string is not translated
+ t.msgstr.blank? ? t.msgstr = nil : t.msgstr = t.msgstr
puts "Creating text #{locale}:#{t.msgstr}"
key.translations.create!(:locale=>locale, :text=>t.msgstr)

0 comments on commit 5c309f3

Please sign in to comment.
Something went wrong with that request. Please try again.