<commit_before>module Spree
  module Admin
    class MailMethodsController < Spree::Admin::BaseController
      after_action :initialize_mail_settings

      def update
        params.each do |name, value|
          next unless Spree::Config.has_preference? name

          Spree::Config[name] = value
        end

        flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:mail_methods))
        render :edit
      end

      def testmail
        if TestMailer.test_email(spree_current_user).deliver_now
          flash[:success] = Spree.t('admin.mail_methods.testmail.delivery_success')
        else
          flash[:error] = Spree.t('admin.mail_methods.testmail.delivery_error')
        end
      rescue StandardError => e
        flash[:error] = Spree.t('admin.mail_methods.testmail.error') % { e: e }
      ensure
        redirect_to spree.edit_admin_mail_methods_url
      end

      private

      def initialize_mail_settings
        Spree::Core::MailSettings.init
      end
    end
  end
end
<commit_msg>Fix missing translation<commit_after>module Spree
  module Admin
    class MailMethodsController < Spree::Admin::BaseController
      after_action :initialize_mail_settings

      def update
        params.each do |name, value|
          next unless Spree::Config.has_preference? name

          Spree::Config[name] = value
        end

        flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:mail_method_settings))
        render :edit
      end

      def testmail
        if TestMailer.test_email(spree_current_user).deliver_now
          flash[:success] = Spree.t('admin.mail_methods.testmail.delivery_success')
        else
          flash[:error] = Spree.t('admin.mail_methods.testmail.delivery_error')
        end
      rescue StandardError => e
        flash[:error] = Spree.t('admin.mail_methods.testmail.error') % { e: e }
      ensure
        redirect_to spree.edit_admin_mail_methods_url
      end

      private

      def initialize_mail_settings
        Spree::Core::MailSettings.init
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08565928777670838, 'fraction_numerical': 0.0, 'mean_word_length': 2.6156521739130434, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5624490', 'n_tokens_mistral': 613, 'n_tokens_neox': 602, 'n_words': 118}