Localization

7 Dec 2017 / 1 minute to read

Localization is the process of customizing an application for given language and region.

Configure the Syncfusion Components to a particular language by the following steps.

  1. Specify the target culture in web.config file under </kbd> root.

       
     <system.web>
         <globalization uiCulture="fr-FR" culture="fr-FR" enableClientBasedCulture="true"/>
     </system.web>
  2. Load the globalize culture file from i18n folder dynamically by using the following codes.

       
     @Scripts.Render("~/Scripts/ej/i18n/ej.culture." + System.Globalization.CultureInfo.CurrentCulture.Name.ToString() + ".min.js")
  3. Download and refer to the Syncfusion UI component localized text from ej-global repository.

  4. Load the Localized text file from localetexts folder like the previous step.

       
     @Scripts.Render("~/Scripts/ej/localetexts/ej.localetexts." + System.Globalization.CultureInfo.CurrentCulture.Name.ToString() + ".js")
  5. Set the culture to Syncfusion UI components using the Locale helper method as shown in the following:

      
     @(Html.EJ().DatePicker("MyFirstDatepicker")
         .MinDate(new DateTime(2016, 5, 1))
         .MaxDate(new DateTime(2016, 12, 31))
         .Locale(System.Threading.Thread.CurrentThread.CurrentCulture.Name) // Specify the UI culture
         .ClientSideEvents(events =>
         events.Change("datepicker_change") // To handle datepicker change event
         .Select("datepicker_select") // To handle datepicker select event
         )
     )
  6. Compile and execute the application. You can be able to see the following output in the browser.