Only silence I18n deprecation warning if attr exists.

Fixes #1950.