x5at6w
Last Updated: January 12, 2017
·
3.215K
· kulesa

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.

2 Responses
Add your response

13026

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

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 ·