<commit_before>module LightService
  class Localizer
    def failure(message_or_key, action_class, i18n_options={})
      if message_or_key.is_a?(Symbol)
        i18n_options.merge!(type: :failure)
        translate(message_or_key, action_class, i18n_options)
      else
        message_or_key
      end
    end

    def success(message_or_key, action_class, i18n_options={})
      if message_or_key.is_a?(Symbol)
        i18n_options.merge!(type: :success)
        translate(message_or_key, action_class, i18n_options)
      else
        message_or_key
      end
    end

    def translate(key, action_class, options={})
      type = options.delete(:type)

      scope = i18n_scope_from_class(action_class, type)
      options.merge!(scope: scope)

      I18n.t(key, options)
    end

    private

    def i18n_scope_from_class(action_class, type)
      "#{action_class.name.underscore}.light_service.#{type.to_s.pluralize}"
    end
  end
end<commit_msg>Make Localizer#translate a private method<commit_after>module LightService
  class Localizer
    def failure(message_or_key, action_class, i18n_options={})
      if message_or_key.is_a?(Symbol)
        i18n_options.merge!(type: :failure)
        translate(message_or_key, action_class, i18n_options)
      else
        message_or_key
      end
    end

    def success(message_or_key, action_class, i18n_options={})
      if message_or_key.is_a?(Symbol)
        i18n_options.merge!(type: :success)
        translate(message_or_key, action_class, i18n_options)
      else
        message_or_key
      end
    end

    private

    def translate(key, action_class, options={})
      type = options.delete(:type)

      scope = i18n_scope_from_class(action_class, type)
      options.merge!(scope: scope)

      I18n.t(key, options)
    end

    def i18n_scope_from_class(action_class, type)
      "#{action_class.name.underscore}.light_service.#{type.to_s.pluralize}"
    end
  end
end
{'fraction_non_alphanumeric': 0.09029927760577916, 'fraction_numerical': 0.018575851393188854, 'mean_word_length': 3.1698924731182796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6413715', 'n_tokens_mistral': 678, 'n_tokens_neox': 653, 'n_words': 115}