CMS Enabled / Requests for MicrosoftAjax.de.js / Multilanguage
We noticed that our 9.4.1 DNN makes requests to MicrosoftAjax.de.js if the locale is set to German and CMS is enabled. While our page doesn't require Ajax and works with Java Script disabled, it adds a request that fails during page load, because localized versions of MicrosoftAjax.js do not exist afaik. It resulted in some flickering when switching between pages.
The fix was to change this in AJAX.cs: using (var scriptManager = new ScriptManager //RadScriptManager { ID = "ScriptManager", EnableScriptGlobalization = true, SupportsPartialRendering = true })
into that: using (var scriptManager = new ScriptManager //RadScriptManager { ID = "ScriptManager", EnableScriptGlobalization = true, SupportsPartialRendering = true, EnableScriptLocalization = false })
Is this still an issue in 9.9.0?
Yes, I just checked the most up-to-date Ajax.cs version. But I haven't tried it yet on a fresh DNN install.
We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!
This issue has been closed automatically due to inactivity (as mentioned 14 days ago). Feel free to re-open the issue if you believe it is still relevant.
I would have a patch for this issue that I could submit in case anyone is interested in this.
Can anyone, running multiple languages, using modules that include Ajax and having CDN enabled for Ajax, confirm that they have the same problem? You should be able to see the failed request, due to the wrong file name generated having the language code added, in a Browser network trace.
To enable the CDN for Ajax you need to set 'EnableMsAjaxCDN' in the HostSettings table to Y. The code will then attempt to load the Ajax stuff from a Microsoft server (CDN). If you then switch to a page using a module with Ajax you should see that it works for English but not for other languages (for example German), because the generated file name is not available for download on the Microsoft CDN.
I would be glad if I could submit this so I don't have to use a custom build anymore.
Best regards & happy DNNing Andy9999
So, is the situation that the script localization works when served locally, but does not work when served via CDN? It would seem we would prefer to provide the localization if it's available. Should we turn off script localization only if the CDN is enabled? And we'd require users who want script localization to disable the CDN?
I will test it one more time as a lot of time has passed, but if I remember correctly it also would occur if CDN is disabled. The fix would then be, to simply copy the existing original version and give the copy the expected file name. But I could be wrong. The problem with CDN being enabled is clearly that you cannot create that additional copy on Microsoft's CDN server.
Best regards & happy DNNing Andy9999
Well, if it doesn't work at all, then we can just always set EnableScriptLocalization to false, right?
True. :) That's exactly what I did so far in my custom build. I hope I can get to this next weekend.
Best regards & happy DNNing Andy9999
A tiny update.
This is the URL to Ajax being used: https://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjax.js
There is a folder below with the name globalization and inside there is for example a file "fr-FR.js" or "de-DE.js". I am not sure if this is loaded automatically by the main script.
So this is for example a valid URL: https://ajax.aspnetcdn.com/ajax/4.6/1/globalization/fr-FR.js or https://ajax.aspnetcdn.com/ajax/4.6/1/globalization/de-DE.js
I have opened an issue over here and hope someone can clarify: https://github.com/dotnet/AspNetDocs/issues/594
Best regards & happy DNNing Andy9999
Here is some interesting documentation about globalization support in ASP.NET AJAX applications: https://docs.microsoft.com/en-us/archive/msdn-magazine/2008/january/globalization-support-in-asp-net-ajax-applications
According to that article, setting EnableScriptLocalization to true (the default) should cause the following to be included (which resembles of the fr-FR.js content for example): var __cultureInfo = '{"name":"en-GB", "numberFormat":{ "CurrencyDecimalDigits":2, "CurrencyDecimalSeparator":".","IsReadOnly":true, "CurrencyGroupSizes":[3],"NumberGroupSizes":[3], "PercentGroupSizes":[3],"CurrencyGroupSeparator":", ", "CurrencySymbol":"£","NaNSymbol":"NaN", "CurrencyNegativePattern":1,"NumberNegativePattern":1, "PercentPositivePattern":0,"PercentNegativePattern":0, "NegativeInfinitySymbol":"-Infinity","NegativeSign":"- ...
Maybe this problem occurs in conjunction with EnableMsAjaxCDN being enabled only.
Here is one other person complaining, in this case about MicrosoftAjax.zh-Hant.js: https://github.com/dotnet/AspNetCore.Docs/issues/10133
Am still wondering what is going on there and how the js files inside of that globalization folder should get loaded.
Best regards & happy DNNing Andy9999
Hm, seems I found another piece of the puzzle here: https://developercommunity.visualstudio.com/t/404-error-in-browser-console-if-i-set-scriptmanage/538213
"This is an unfortunate side effect of ScriptManager enabling localization by default. Microsoft does not produce localized versions of the MSAjax framework, so they do not exist on the CDN. You can disable localization by setting the 'EnableScriptLocalization' of ScriptManager to 'false'."
Best regards & happy DNNing Andy9999
LOL. Case closed -> https://github.com/dotnet/AspNetDocs/issues/594
Maybe referring me to StackOverflow was helpful: https://stackoverflow.com/questions/817046/what-about-script-globalization-of-microsoftajax-js-in-asp-net-mvc
Documenting it properly would have been even more helpful in the first place. Looks like a bug to me. But anyways. At least something to work with.
This article lead me here and explains how to make use of those files in the globalization folder: http://haacked.com/archive/2010/05/10/globalizing-mvc-validation.aspx/
Best regards & happy DNNing Andy9999