We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Locale for uploadbox sets wrong property

Thread ID:

Created:

Updated:

Platform:

Replies:

130386 May 10,2017 02:16 PM UTC May 19,2017 05:42 AM UTC ASP.NET MVC 9
loading
Tags: Uploadbox
Wouter
Asked On May 10, 2017 02:16 PM UTC

This code:
            @(Html.EJ().Uploadbox("albumUpload").CssClass("albumUpload")
                  .UploadBoxDialogAction(e => e.CloseOnComplete(false))
                  .ExtensionsAllow(".jpg, .jpeg, .png")
                  .ExtensionsDeny(".pdf, .docx")
                  .MultipleFilesSelection(true)
                  .UploadName("albumUpload")
                  .AllowDragAndDrop(true)
                  .ShowFileDetails(true)
                  .Locale("en-US")
                  )
Generates this HTML:

            <div id="albumUpload"
                 data-role="ejuploadbox"
                 data-ej-locale="en"
                 data-ej-allowdraganddrop="true"
                 data-ej-extensionsallow=".jpg, .jpeg, .png"
                 data-ej-extensionsdeny=".pdf, .docx"
                 data-ej-uploadname="albumUpload"
                 data-ej-cssclass="albumUpload"></div>

Instead of the HTML with the correct locale:

            <div id="albumUpload"
                 data-role="ejuploadbox"
                 data-ej-locale="en-US"
                 data-ej-allowdraganddrop="true"
                 data-ej-extensionsallow=".jpg, .jpeg, .png"
                 data-ej-extensionsdeny=".pdf, .docx"
                 data-ej-uploadname="albumUpload"
                 data-ej-cssclass="albumUpload"></div>

Prince Oliver [Syncfusion]
Replied On May 11, 2017 12:25 PM UTC

Hi Wouter,   
  
Thank you for contacting Syncfusion support.   
  
The default locale is en-US, hence setting it in the locale will not reflect in html. In case, if you have set ar-AE (Arabic) or any other language in locale, it will be set to the data-ej-locale attribute. This is the default behavior in our controls.   
  
We have prepared a sample demonstrating locale (en-US) in upload box. Kindly refer to the following link for the sample: http://www.syncfusion.com/downloads/support/forum/130386/ze/uploadSample400272443 
  
Regards,   
Prince      


Wouter
Replied On May 11, 2017 01:56 PM UTC

Thanks for your answer, but this is not the solution. My application runs in the "en" culture (invariant culture). Setting the locale to Locale("en-US") results in this html attribute: data-ej-locale="en". As you point out, when the running culture matches the given locale the attribute is omitted. In this case the attribute is included with an invalid value. Omitting would be far better in this case.

I had a hard time running your example, but I updated it to make it work and display the aforementioned issue. You can download it here: https://www.dropbox.com/sh/y5pf769c8j4l2p9/AACeHMqhTHT5b0aafeYqtOcUa/SF.Sample.Upload.zip?dl=0





Prince Oliver [Syncfusion]
Replied On May 12, 2017 07:28 AM UTC

Hi Wouter,      
  
Thank you for your update.   
  
We checked the shared modified sample, but we were unable to reproduce the issue, it is working as expected. Refer to the following screenshot.   

 

Please provide us additional details to reproduce the issue. Provide us the Syncfusion version of your using, browser version and Operating system. It may help us replicate the issue and provide solution.   
  
Regards,   
Prince    


Wouter
Replied On May 12, 2017 07:54 AM UTC

I got this: (included code that sets the cultureinfo)



Prince Oliver [Syncfusion]
Replied On May 15, 2017 10:22 AM UTC

Hi Wouter,   
  
Thank you for your update.   
  
We have included the cultureInfo in application begin request method as per the shared screenshot and set the culture as “en”, we are unable to reproduce the issue in locale. Kindly refer to the following link for the Sample: http://www.syncfusion.com/downloads/support/forum/130386/ze/uploadSample-771562739 
  
You can try setting the culture as “en-US” instead of “en”, to check if it resolves the issue. Kindly refer to the following code snippet.   

protected void Application_BeginRequest(Object sender, EventArgs e) 
        { 
            CultureInfo ci = new CultureInfo("en-US") {  DateTimeFormat = { ShortDatePattern = "dd-MM-yyyy" } }; 
            Thread.CurrentThread.CurrentUICulture = ci; 
            Thread.CurrentThread.CurrentCulture = ci; 
        } 

Regards, 
Prince 


Wouter
Replied On May 16, 2017 12:37 PM UTC

Hi Prince Oliver,

Setting the culture to "en-US" does solve the problem, but that is not an option for us. Our real solution is a bit more complex. The problem is that the component cant cope with a neutral culture.  Setting the thread to culture "en" shouldnt result in the component rendering " data-ej-locale="en" " since this cannot be handled. If the component would fall back to using "en-US" it's still usable. This is just a case of the component rendering itself into an unusable state.

Regards,



Prince Oliver [Syncfusion]
Replied On May 18, 2017 05:58 AM UTC

Hi Wouter,   
  
Thank you for your update.   
  
When the locale is set as “en”, the uploadbox control will not be rendered as the localization for “en” is not defined. We have defined and set “en-US” as default localization which will be set only if locale property is undefined. So, in your case we need to define localization for “en” or we can copy it from “en-US”. Kindly refer to the following code snippet.   

<script> 
        ej.Uploadbox.Locale["en"] = ej.Uploadbox.Locale["en-US"] 
</script> 
  

Regards, 
Prince 


Wouter
Replied On May 18, 2017 10:24 AM UTC

> "When the locale is set as “en”, the uploadbox control will not be rendered as the localization for “en” is not defined. "

That's what I was saying all along.

I already had a workaround. I'll leave this to syncfusion, but I think the control should render only one of the available localizations in any case. The point is to use MVC controls, without extra workarounds in JS, otherwise a JS would be more fitting.

Prince Oliver [Syncfusion]
Replied On May 19, 2017 05:42 AM UTC

Hi Wouter,      
     
Thank you for your update.     
  
As mentioned in the previous update, default localization will be used only when the localization is not set manually. You have set localization in cultureinfo as “en”, so it is set to the control after serializing. Our controls are render based on JavaScript, hence we need to use the JS workaround provided in the previous update.   
  
Regards,   
Prince   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;