0

My Helper..

module WatableHelper

  # binding.pry

  ANALYTICS_MEMBERS_FORMAT_COLS = {
    email:  {
      index:    1,
      type:     'string',
      friendly: I18n.t('system_roles.email'),
      unique:   true
    },
    name:   {
      index:    2,
      type:     'string',
      friendly: I18n.t('admin_courses.th.name'),
      filter:   ''
    },
    status: {
      index:    3,
      type:     'string',
      friendly: I18n.t('admin_courses.th.status'),
      filter:   false
    }
  }.freeze

When this class is loaded it will return :

translation missing: en.system_roles.email

The reason being is that if I run I18n.load_path, I can see that none of my locales have been loaded yet. I'm guessing this is because Rails will boot the Rails helpers before the locales, and after that string gets set, it gets frozen as translation missing.

If I run reload! in my console, this class will load as expected, and my locales are then located within the load path.

Anyone have any idea what the proper way to load those I18n translations?

Thanks!

Trip
  • 26,756
  • 46
  • 158
  • 277

1 Answers1

1

Maybe can you try to require your locale, in this way it will loaded before:

require_relative 'your_path/until/your_locale

morissetcl
  • 544
  • 3
  • 10
  • Definitely an honest response. I think for now I'm going with just baking these in as private methods instead of class constants. – Trip Aug 14 '19 at 16:11