jeudi 11 novembre 2021

Customize Fedena flash messages

How can I customize flash messages from Fedena? for example in the forgot page, when user supplies not existing username, it displays this message no username exists with username How can I customize that message to the user supplied does not exist! in the source code I see for example, this code flash[:notice] = "#{t('flash18')}". when traced the t() function. it redirects to the translator.rb which contains

module ActionController #:nodoc:
  class Base
    
    # Add a +translate+ (or +t+) method to ActionController that is context-aware of what controller and action
    # is being invoked. Initial scoping will be [:controller_name :action_name] when looking up keys. Example would be
    # +['posts' 'show']+ for the +PostsController+ and +show+ action.
    def translate_with_context(key, options={})
      Translator.translate_with_scope([self.controller_name, self.action_name], key, options)
    end
  
    alias_method_chain :translate, :context
    alias :t :translate
  end
end

module ActiveRecord #:nodoc:
  class Base

    def translate(key, options={})
      Translator.translate_with_scope([self.class.name.underscore], key, options)
    end
  
    alias :t :translate
  
    # Add translate as a class method as well so that it can be used in validate statements, etc.
    class << Base
    
      def translate(key, options={}) #:nodoc:
        Translator.translate_with_scope([self.name.underscore], key, options)
      end
    
      alias :t :translate
    end
  end
end

but I don't see the string I was after i.e no user exists with username. How can I customize these messages in fedena?

Aucun commentaire:

Enregistrer un commentaire