Localizing AJAX File Browser

The IT Hit AJAX File Browser control can be localized to any language. The most simple approach is just to localize all strings stored in ITHitAJAXFileBrowser.js file. The strings are not compressed so you can easily replace them with a translated version.

The more advanced approach is to pass localized strings to constructor in Settings.Phrases object. In this case, you do not need to edit the original ITHitAJAXFileBrowser.js file:

 ITHit.oNS.EN = {

var phrases = {
 AjaxFileBrowser: {
  
  Interface: {
   
   Buttons: {
    Copy: 'Copy',
    Cut: 'Cut',
    Delete: 'Delete',
    Details: 'Details',
    Folders: 'Folders',
    Info: 'Properties',
    Paste: 'Paste',
    Up: 'Up'
   },
   
   Add: 'Add',
   AddProperty: 'Add Property',
   Address: 'Address:',
   BrowseFiles: 'Browse...',

   ...

  }

 }

};

 
var settings = {
   BasePath: '/',
    Id: 'AjaxFileBrowserContainer',     // ID of the parent control 
    Url: 'http://webdavserver.com',     // the root folder to be displayed
    Style: 'height: 100%; width: 100%',
    MsOfficeTemplatesPath: 'http://webdavserver.com/MSOfficeTemplates/',
    SelectedFolder: '/Pictures',        // folder to be selected
    Phrases: phrases                    // localized strings

}; 


ajaxFileBrowserLoader = new ITHit.WebDAV.Client.AjaxFileBrowserLoader(settings);

You can find all string IDs in ITHitAJAXFileBrowser.js. If any string is not passed to the constructor the English analog will be used.

Next Article:

AJAX File Browser Request Pipeline