0

I have an ASP.NET 4.8 MVC app that has numerous languages. These are RESX files which are defined in their own class library. That class library is then being injected into the MVC app using LightInject as the Dependancy Injection library.

I am having trouble with some users reporting that our site is displaying them in a different language randomly, which leads me to believe I haven't configured the lifetime of the Language Class library correctly. However looking at the documentation of LightInject, the default scope appears to be the correct one: https://www.lightinject.net/#lifetime (and more on their scopes here: https://www.lightinject.net/#scope)

In all cases of the issue - the users browser language and OS language was different to the one being shown on the website. (Ie Someone in the US with browser language set to English and OS set to United States English, took a screenshot and the page was rendering in Dutch!)

Seeing its so random Im finding it very hard to replicate and resolve so if anyone has had a similar issue I would love to know how you solved it - or even what Scope you are using for your resx classes if you don't have the same issue!

Thank you in advance :)

dalcam
  • 1,027
  • 11
  • 28
  • 2
    I'm afraid that your question needs more details to be suited for Stack Overflow. As it currently stand there could be a thousand reasons why things are going wrong. I'm afraid you will have to do some more digging and narrow the problem down to a level that you can show us a minimal reproducible example that demonstrates the problem. I know this likely not the answer you want. What might help is adding extra lines of logging code to detect wrong combination of language with user settings. – Steven Aug 26 '20 at 16:57
  • As @Steven without reasonable [MCVE] it is impossible to answer. In particular loginc from that mysterious "the Language Class library" would need to be shown as sample code. – Alexei Levenkov Aug 26 '20 at 17:17
  • @Steven, thank you - point taken. Ill see what I can add as further details. – dalcam Aug 26 '20 at 18:41
  • @AlexeiLevenkov - its as simple as it sounds! Its simply resx files (which .net builds into classes) that are contained within a class library so that i can share the language resources between projects in the solution. – dalcam Aug 26 '20 at 18:43
  • @Steven - I added details of the settings of the users that got the issues - thanks for that suggestion – dalcam Aug 26 '20 at 18:49
  • @dalcam I see - I have not heard those to be called that way... "satellite localization assemblies" or just "localization assemblies"... and they have no registration in DI at all. You need to figure out who/how sets "current culture" for request to investigate/[edit] question with [MCVE]. – Alexei Levenkov Aug 26 '20 at 18:55

0 Answers0