ResourceManager.String

Syntax

String: String;

Description

The String property determines string for specified language, resource key and field name.

Comments

Property value is set with the setString method. The following parameters need to be specified: value - string value, culture - a PP.CultureInfo object, resourceKey - resource key, fieldName - field name or array of names. Property value cannot be set from JSON.

The getString method is used to get the value. This method requires two parameters - fieldName and resourceKey, or only the resourceKey parameter to be defined.

Example

Before executing the example start the script given in the page with description of the ResourceManager.RootResourcesFolder property. Get strings using resource keys login, dateTimeEditMonthNames1, ExpressPropertyBubbleChart for Russian and English languages, process the StartupSetLoaded event by executing the following example in the browser console:

// Process the StartupSetLoaded event
PP.resourceManager.StartupSetLoaded.add(function (sender, args) {
    console.log("All resources files for current language are connected");
});
// Set custom resources
PP.resourceManager.setString("User name", PP.Cultures.ru, "login");
PP.resourceManager.setStrings([
    ["User name", PP.Cultures.en, "login"]
]);
console.log("Current language - Russian");
// Set Russian as a current language
PP.setCurrentCulture(PP.Cultures.ru);
// Get name of the "Login" field by the "login" resource key
console.log(PP.resourceManager.getString("login"));
// Resources from the file PP.resources.ru.js           
console.log(PP.resourceManager.getString("dateTimeEditMonthNames1"));
// Resources from the file Express.resources.ru.js
console.log(PP.resourceManager.getString("Content", "ExpressPropertyBubbleChart"));
console.log("");
console.log("Current language - English");
// Set English as a current language
PP.setCurrentCulture(PP.Cultures.en);
// Get name of the "Login" field by the "login" resource key
console.log(PP.resourceManager.getString("login"));
// Resources from the file PP.resources.en.js
console.log(PP.resourceManager.getString("dateTimeEditMonthNames1"));
// Resources from the file Express.resources.en.js
console.log(PP.resourceManager.getString("Content", "ExpressPropertyBubbleChart"));

After executing the example the browser console displays strings by resource keys login, dateTimeEditMonthNames1, ExpressPropertyBubbleChart for Russian and English languages and also the notifications that all resource files to output after changing the current language, are connected:

Current language - Russian
All resource files for the current language are linked
User name
January
Bubble chart

Current language - English
All resource files for the current language are linked
User name
January
Bubble chart

See also:

ResourceManager