Reputation: 22238
We're migrating our Rails app to using a different I18n backend, so not using the default yml files, or any files at all choosing to download the translations from an internal service.
In our previous implementation we would parse all the keys from the YAML files for the purposes of exposing translations to javascript, so we'd end up with an array of keys like date.day_names
etc.
However, now we've no YAML in play our current method doesn't work.
How can we extract all the keys we have from our current backend in Rails?
Upvotes: 1
Views: 1473
Reputation: 680
For me in rails 7 I18n.backend.translations
works.
To find keys, I execute File.write('i18n.json', JSON.pretty_generate(I18n.backend.translations))
And open this file in RubyMine and see JSON path in the bottom (https://stackoverflow.com/a/58239189/4284095)
Upvotes: 1