Compartir a través de


WinJS.Resources.getString function

Retrieves the resource string that has the specified resource identifier.

Syntax

var object = WinJS.Resources.getString(resourceId);

Parameters

  • resourceId
    Type: String

    The resource ID of the string to retrieve.

Return value

Type: Object

An object that can contain these properties:

  • value
    The value of the requested string. This property is always present.

  • empty
    A value that specifies whether the requested string wasn't found. If it's true, the string wasn't found. If it's false or undefined, the requested string was found.

  • lang
    The language of the string, if specified. This property is present only for multi-language resources.

Examples

This example is based on scenario 3 of the Application resources and localization sample. See the sample for the more complete solution.

var statusDiv = document.getElementById("statusMessage");
var str = WinJS.Resources.getString('scenario3Message');
statusDiv.textContent = str.value;
statusDiv.lang = str.lang; // Set the lang attribute to ensure proper font choice.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Resources

See also

WinJS.Resources

Application resources and localization sample