PP.getCurrentCulture

Syntax

getCurrentCulture();

Description

The getCurrentCulture method returns the current language and regional settings.

Comments

This method returns a PP.CultureInfo value.

Example

To execute the example, add a link to PP.js scenario file to HTML page. Get the current language and check if the values 12, «12», «0.07» and «0,07» correspond to numbers:

// Get current regional settings
var culture = PP.getCurrentCulture();
console.log("Current language: " + culture.DisplayName + ".");
// Check if the 12, «12», «0.07» and «0,07» values are numbers
var isNumber = culture.validateNumber({
    value: 12
});
console.log("The 12 value " + (isNumber ? "is" : "is not") + " a number.");
isNumber = culture.validateNumber({
    value: "12"
});
console.log("The «12» value " + (isNumber ? "is" : "is not") + " a number.");
isNumber = culture.validateNumber({
    value: "0.07"
});
console.log("The «0.07» value " + (isNumber ? "is" : "is not") + " a number.");
isNumber = culture.validateNumber({
    value: "0,07"
});
console.log("The «0,07» value " + (isNumber ? "is" : "is not") + " a number.");

After executing the example the browser console displays the current language and information that within the listed values only the string «0.07» does not correspond to a number (in Russian language a point cannot be used as a decimal separator):

Current language: Russian

The value 12 is a number.

The value «12» is a number.

The value «0.07» is not a number.

The value «0,07» is a number.

See also:

PP