Remove I18n.translation_present?
monkey patch
This commit is contained in:
@ -24,7 +24,7 @@ module ApplicationHelper
|
|||||||
def label_column(label)
|
def label_column(label)
|
||||||
tag.div(class: 'col-md-3') do
|
tag.div(class: 'col-md-3') do
|
||||||
tag.strong do
|
tag.strong do
|
||||||
I18n.translation_present?("activerecord.attributes.#{label}") ? t("activerecord.attributes.#{label}") : t(label)
|
I18n.exists?("activerecord.attributes.#{label}") ? t("activerecord.attributes.#{label}") : t(label)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"))
|
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"))
|
||||||
- if object
|
- if object
|
||||||
- current_element = link_to_if(current_user && policy(object).show?, object, send(:"#{model.model_name.singular}_path", object))
|
- current_element = link_to_if(current_user && policy(object).show?, object, send(:"#{model.model_name.singular}_path", object))
|
||||||
- if I18n.translation_present?("shared.#{params[:action]}")
|
- if I18n.exists?("shared.#{params[:action]}")
|
||||||
- active_action = t("shared.#{params[:action]}", model: model&.model_name&.human)
|
- active_action = t("shared.#{params[:action]}", model: model&.model_name&.human)
|
||||||
- else
|
- else
|
||||||
- active_action = t("#{controller_name}.index.#{params[:action]}", model: model&.model_name&.human)
|
- active_action = t("#{controller_name}.index.#{params[:action]}", model: model&.model_name&.human)
|
||||||
|
@ -7,9 +7,3 @@ unless Array.respond_to?(:average)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module I18n
|
|
||||||
def self.translation_present?(key)
|
|
||||||
t(key, default: '').present?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
@ -76,7 +76,7 @@ private :obtain_object
|
|||||||
def obtain_message(object)
|
def obtain_message(object)
|
||||||
if object.is_a?(String)
|
if object.is_a?(String)
|
||||||
object
|
object
|
||||||
elsif I18n.translation_present?(object)
|
elsif I18n.exists?(object)
|
||||||
I18n.t(object)
|
I18n.t(object)
|
||||||
else
|
else
|
||||||
send(object)
|
send(object)
|
||||||
|
Reference in New Issue
Block a user