Hi,I have been developing my whole application with "AutoDetectLocale(true)" with no issues on my local machine or our dev machine.
During final testing, we used some different browsers, (one of these has the language set to dutch).When trying to open a page with an Infragistics element I get the following error in the chrome console: "http://localhost:81/........../Scripts/Infragistics/js/modules/i18n/infragistics.util-nl.js Failed to load resource: the server responded with a status of 404 (Not Found)"
Is there a way to fall back on the gb / UK local for non supported locals?Thanks in advanceGreetingsXavier, Segrey Software BVBA
Hello Xavier,
Thank you for posting in our community.
I am currently investigating how locale can be set in cases that is not in the locale list of the igLoader control. I will keep ypu poste don my progress and I will get back to you until the end of the business day tomorrow, September 16th, with my findings.
Please feel free to let me know if you have any additional questions regarding this matter.
Thank you for your patience while I was looking into this matter for you.
For accomplishing a locale based on the current browser language and reverting the locale to English when current language is not supported the UserLanguages can be used.It can be retrieved from the Request and later set as the locale option for the igLoader. By design 'en-US' locale is built in the Infragistics controls and there is no need to explicitly set it if this is the current browser language. If the language is different form English it can be retrieved and used for setting locale option afterwards when the igLoader is created. All localization files are in the i18 folder. For example:
@{ var userLanguages = Request.UserLanguages; string currentUserLang = userLanguages[0]; if (currentUserLang == "en-US" || currentUserLang == "en") { currentUserLang = ""; } //TODO check if currentUserLang is valid (exists in i18n dir) string path = "Your current path of the i18 folder"; //get all the js files names in the i18 dir in array of strings string[] files = Directory.GetFiles(path, "*.js"); //loop trough this array and check whether the browser language matched any of the supported languages. for (int i = 0; i < files.Length; i++){ if(currentUserLang == files[i].Substring(70,72)) { currentUserLang = userLanguages[0]; } //if currentUserLang does not match any of the supported languages set it as an empty string which will imply English localization else{ currentUserLang = ""; } } } @(Html.Infragistics() .Loader() .ScriptPath(Url.Content("http://localhost/ig_ui16.1rel/js/")) .CssPath(Url.Content("http://localhost/ig_ui16.1rel/css/")) .Locale(currentUserLang) .Resources("igGrid.*,igCombo") .Render() )
Please let me know if you need any further assistance with this matter.
Hi,Ok, Thank you.I will try this out later this week and get back to you. Greetings Xavier
Hello,
Please feel free to contact me if you have any additional questions.
I am glad that you managed to achieve your requirement.
Please feel free to contact me if you need any further assistance with this matter.
Hi,Well thank you for the reply.So after reviewing what you did, it is clear there is no official supported way to determine this.With your workaround, there are a few issues.A) This is main issue I have with this implementation. It would give a lot of unneeded and unwanted I/O overhead, as it would have to go through extra additional files and directories, on each request for pages using infragistic components.
B)I will have to manually check how all of the browser fill in the userlanguage. (Not that much work, but still), and hope for the best, that implementation never changes.C) Once the filename changes, it may not be guaranteed that the substrings are at the same location.So in other words. Too many issues.For now, I sort of used the same way, but instead of reading files, I just assigned an array of possible allowed languages.We will probably change this later on, by assigning one language at the start of the application for every user being logged in.