Skip to content

ParseAndTranslate change headers. #338

@jeancroy

Description

@jeancroy

The recommended way to translate a segment of text is

    string entity = HttpContext.ParseAndTranslate("Hi - [[[Sign in]]]");

However it does a bit more that just translate the text, it try to setup headers as a side effect.
It make a call to ProcessOutgoing which aim to rewrite url consistently with url localisation scheme. BUT that method also try to rewrite url in headers

Possible problem of those hidden side effect include error when there are no http response. (for example sending email at scheduled time)

System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.
   at System.Web.HttpResponse.get_Headers()
   at System.Web.HttpResponseWrapper.get_Headers()
   at i18n.EarlyUrlLocalizer.ProcessOutgoing(String entity, String langtag, HttpContextBase context)
   at i18n.HttpContextExtensions.ParseAndTranslate(HttpContextBase context, String entity

Possible solution include splitting ProcessOutgoing as ProcessOutgoingNuggets and ProcessOutgoingHeaders. Then call header localization only when filtering request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions