Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
igloader autolocale / script not found
posted

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 advance

Greetings

Xavier, Segrey Software BVBA

Parents
  • 17590
    Offline posted

    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.

Reply
  • 17590
    Offline posted in reply to Vasya Kacheshmarova

    Hello Xavier,

    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.

Children