diff --git a/app/helpers/email_helper.rb b/app/helpers/email_helper.rb index a1373329b8e..55b824ded30 100644 --- a/app/helpers/email_helper.rb +++ b/app/helpers/email_helper.rb @@ -26,7 +26,10 @@ module EmailHelper end def email_html_template - EmailStyle.new.html.sub('%{email_content}', capture { yield }).html_safe + EmailStyle.new.html + .sub('%{email_content}', capture { yield }) + .gsub('%{html_lang}', html_lang) + .html_safe end protected diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rb index 38a7955e433..b438e095e49 100644 --- a/spec/mailers/user_notifications_spec.rb +++ b/spec/mailers/user_notifications_spec.rb @@ -236,6 +236,14 @@ describe UserNotifications do expect(html).to include(topic_url) expect(text).to include(topic_url) end + + it "applies lang/xml:lang html attributes" do + SiteSetting.default_locale = "pl_PL" + html = subject.html_part.to_s + + expect(html).to match(' lang="pl-PL"') + expect(html).to match(' xml:lang="pl-PL"') + end end end