ResourceManager.RootResourcesFolder

Syntax

RootResourcesFolder: String;

Description

The RootResourcesFolder property indicates root folder that contains resource files.

Comments

Property value can be set from JSON or using the setRootResourcesFolder method.

Example

To execute the example, create an HTML page, and add a link to the PP.js file in the <head> tag. Parent directory for the current root folder must contain resources folder named "resources". Load resources for Russian and English language in the page, process the ResourceFileLoaded and ResourcesLoaded events by executing the following scenario in the browser console:

// Specify path to root folder containing resources files
PP.resourceManager.setRootResourcesFolder("../resources/", False);
// Specify list of resource files
PP.resourceManager.setResourceList(["PP"]);
PP.resourceManager.addToResourceList(["Express"]);
// Process the ResourceFileLoaded event
PP.resourceManager.ResourceFileLoaded.add(function (sender, args) {
    console.log("Loaded resource file " + args.Name + ".resources." + args.Culture.CultureName + ".js");
});
// Process the ResourcesLoaded event
PP.resourceManager.ResourcesLoaded.add(function (sender, args) {
    console.log("All resources from file are loaded");
});
if (PP.resourceManager.isResourceFilesAttached() == null) {
    // Link resource files for Russian language
    PP.resourceManager.attachResourceFiles(PP.Cultures.ru);
    if (PP.resourceManager.isResourceFileAttached("res_ru")) {
        console.log("Resources for RU locale are linked");
    };
    // Link resource files for English language       
    PP.resourceManager.attachResourceFiles(PP.Cultures.en);
    if (PP.resourceManager.isResourceFileAttached("res_en")) {
        console.log("Resources for EN locale are linked");
    }
};

After executing the example resources for Russian and English language are loaded, and appropriate messages are shown in the browser console:

Resources for RU locale are linked

Resources for EN locale are linked

 

More detailed messages are shown after processing the ResourceFileLoaded and ResourcesLoaded events:

Loaded resource file PP.resources.ru.js

All resources from file are loaded

Loaded resource file Express.resources.ru.js

All resources from file are loaded

Loaded resource file PP.resources.en.js

All resources from file are loaded

Loaded resource file Express.resources.en.js

See also:

ResourceManager