You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the HttpContextExtensions.cs file, there is a comment that by setting the updateThreadCulture boolean, the user can change whether the CurrentCulture/CurrentUICulture settings can be changed:
However, this boolean ultimately has no impact; it is not actually used in the method.
It's not clear to me what the intention with this boolean was. Was it meant to allow the end user to ultimately change just the Thread.CurrentThread.CurrentCulture and not the Thread.CurrentThread.CurrentUICulture? Or, was there something else in mind?
I am more than happy to submit a PR that changes the comment, to indicate that it doesn't do anything. That's the easiest thing to do. Probably can't just remove the boolean, as that might break existing usages of the i18n library. Alternatively, I could work on developing a PR that attempts to only update the Thread.CurrentThread.CurrentCulture and not the Thread.CurrentThread.CurrentUICulture. But, seeing as the library user can implement their own SetPrincipalAppLanguageForRequestHandler, then maybe that is the method that end users should use to avoid changing the UI Culture??
The text was updated successfully, but these errors were encountered:
jnpwly
changed the title
Misleading comment on SetPrincipalAppLanguageForRequest -- updateThreadCulture boolean appears to have no effect
Misleading comment on SetPrincipalAppLanguageForRequest -- updateThreadCulture boolean appears to have no effect
Apr 14, 2019
I suspect the SetPrincipalAppLanguageForRequest method has evolved somewhat.
It's original purpose was two-fold:
To explicitly set the PAL that i18n is to use for generating the response to the current request, overriding any PAL determined from eraly request processing.
Looks like 2. was then moved to the handler model with a default handler installed to invoke that default logic -- but updateThreadCulture wasn't adpated at the same time.
I suspect most clients will probably NOT install their own handlers and just expect the default handler here to update the cultures if updateThreadCulture == true.
Maybe the best way forward is:
Remove the updateThreadCulture argument from existing methods. That will break the API but not behaviour that is according to spec.
Add new method: SetPrincipalAppLanguageForRequestWithoutCallingHandlers that does what it says.
In the
HttpContextExtensions.cs
file, there is a comment that by setting theupdateThreadCulture
boolean, the user can change whether the CurrentCulture/CurrentUICulture settings can be changed:i18n/src/i18n/Helpers/HttpContextExtensions.cs
Line 135 in ce7bdc9
However, this boolean ultimately has no impact; it is not actually used in the method.
It's not clear to me what the intention with this boolean was. Was it meant to allow the end user to ultimately change just the
Thread.CurrentThread.CurrentCulture
and not theThread.CurrentThread.CurrentUICulture
? Or, was there something else in mind?I am more than happy to submit a PR that changes the comment, to indicate that it doesn't do anything. That's the easiest thing to do. Probably can't just remove the boolean, as that might break existing usages of the
i18n
library. Alternatively, I could work on developing a PR that attempts to only update theThread.CurrentThread.CurrentCulture
and not theThread.CurrentThread.CurrentUICulture
. But, seeing as the library user can implement their ownSetPrincipalAppLanguageForRequestHandler
, then maybe that is the method that end users should use to avoid changing the UI Culture??The text was updated successfully, but these errors were encountered: