diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1f479af4..ef737f9f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -24,7 +24,7 @@ module ApplicationHelper def label_column(label) tag.div(class: 'col-md-3') 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 diff --git a/app/views/application/_breadcrumbs_and_title.html.slim b/app/views/application/_breadcrumbs_and_title.html.slim index 47ee2726..ff5d1671 100644 --- a/app/views/application/_breadcrumbs_and_title.html.slim +++ b/app/views/application/_breadcrumbs_and_title.html.slim @@ -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")) - if 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) - else - active_action = t("#{controller_name}.index.#{params[:action]}", model: model&.model_name&.human) diff --git a/config/initializers/monkey_patches.rb b/config/initializers/monkey_patches.rb index 201b68d5..3eaf9217 100644 --- a/config/initializers/monkey_patches.rb +++ b/config/initializers/monkey_patches.rb @@ -7,9 +7,3 @@ unless Array.respond_to?(:average) end end end - -module I18n - def self.translation_present?(key) - t(key, default: '').present? - end -end diff --git a/spec/support/controllers.rb b/spec/support/controllers.rb index 3c50c350..6688a4b7 100644 --- a/spec/support/controllers.rb +++ b/spec/support/controllers.rb @@ -76,7 +76,7 @@ private :obtain_object def obtain_message(object) if object.is_a?(String) object - elsif I18n.translation_present?(object) + elsif I18n.exists?(object) I18n.t(object) else send(object)