Search
Localization

To localize the Calendar you should set its "locale" property to an instance of the MindFusion.Common.Locale class.
The Locale class provides culture-specific information, that can be loaded from a CLDR dates json file.
The LocalStrings class holds the dictionary of the caption texts in the calendar control. You can change caption texts by setting the corresponding property of Calendar.locale.strings object to your custom value or by assigning a new dictionary object.

JavaScript  Copy Code

// change a specific caption text 
 calendar.locale.strings.newFormHeader = "Custom Header";

JavaScript  Copy Code

// localize date-time information and strings using CLDR and a localization file
 var url = 'https://unpkg.com/cldr-dates-full/main/de/ca-gregorian.json';
 fetch(url)
  .then(response => response.json())
  .then((data) => {
   // create an instance of the MindFusion.Common.Locale class
   var localeObj = new common.Locale(locale);
   // load the CLDR data
   localeObj.fromJson(JSON.stringify(data));
   // make adjustments, if necessary
   localeObj.dateFormats.shortDate = localeObj.dateFormats.shortDate.replace("yy", "yyyy");
   // load a localization file for the strings
   var fileName = './localization/de.json';
   controls.DomUtils.loadJSON(fileName, (response) => {
    localeObj.strings = JSON.parse(response).strings;
    // pass the localeObj to the calendar.locale property
    calendar.locale = localeObj;
   });
  })
  .catch(err => { throw err });
}