Use default translations
So I have seen this done a few times:
begin
I18n.t "something.to.translate"
rescue I18n::MissingTranslationData
"algo para traducir"
end
but it is a lot more elegant & efficient to use a default value rather than throwing exceptions about
I18n.t "something.to.translate", :default => "algo para traducir"
Written by Ed
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#