x5at6w
Last Updated: January 12, 2017
·
2.871K
· kulesa
77d5192e32ac8e199fa38fd1a7860b72

Find missing translations in your Rails app.

You can easily find missing translations with I18n::MissingTranslations gem.

Add this to Gemfile:

gem "i18n-missing_translations"

And this to the application config:

config.app_middleware.use(I18n::MissingTranslations) unless Rails.env.production?

Now browse your application or run integration tests and voila: config/locales/missing_translations.yml contains all the missing keys.

It is also a nice way to create a translation file from scratch: specify your main traslation file as the destination for missing translations

config.app_middleware.use(I18n::MissingTranslations, 'config/locales/en.yml')

and develop your views not worrying about the translations file - it will be created for you.

Say Thanks
Respond

2 Responses
Add your response

13026
Profile

This only finds the translations that are requested during the test run. To find missing keys pre-emptively with static analysis you can use i18n-tasks gem:

i18n-screenshot

i18n-screenshot

over 1 year ago ·
16200
D438ad8172c80ddc844caabe1baf2e7f

I've been meaning to use it on a Rails 4.1 application, the missing_translations file never seems to be generated ... I've looked up the gem on github, seems pretty old though, and not maintained.

Do you know any thing similar ? (yes, long shot as it's a very old post :) ) Thanks

over 1 year ago ·