Fix header Content-Type: #<Mime::NullType:...> in localized template

This PR is the backport of #13141.
It fixes #13064 regression bug introduced by the #8085.
Merge pull request #13168 from acapilleri/format_localized_template_4_0_stable

Fix header Content-Type: #<Mime::NullType:...> in localized template