0

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?

Neil Middleton
  • 22,105
  • 18
  • 80
  • 134
  • https://stackoverflow.com/a/4054527/23915 – Unixmonkey Nov 30 '21 at 16:01
  • 1
    TLDR: `I18n.translations` will have all the keys, but only after you've loaded them by calling `t`, so `I18n.t('.'); I18n.translations`, or `I18n.translations[:en]` if you only want one language. – Unixmonkey Nov 30 '21 at 16:18

0 Answers0