Skip to content

Commit

Permalink
Simplify html translations by just calling module directly
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Oct 12, 2023
1 parent 8864bbc commit 7319306
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/noticed/translation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module Noticed
module Translation
extend ActiveSupport::Concern

include ActiveSupport::HtmlSafeTranslation if defined?(ActiveSupport::HtmlSafeTranslation)

# Returns the +i18n_scope+ for the class. Overwrite if you want custom lookup.
def i18n_scope
:notifications
Expand All @@ -14,8 +12,8 @@ def class_scope
end

def translate(key, **options)
if defined?(super)
super scope_translation_key(key), **options
if defined?(::ActiveSupport::HtmlSafeTranslation)
ActiveSupport::HtmlSafeTranslation.translate scope_translation_key(key), **options
else
I18n.translate scope_translation_key(key), **options
end
Expand Down

0 comments on commit 7319306

Please sign in to comment.