TX Text Control .NET Server

Javascript: FormattingStyle.getCulture Method

Method|Introduced in 30.0

Description

Gets the culture as a languagecode2-country / regioncode2 string value. Takes a callback function as a parameter which is called with a languagecode2-country / regioncode2 string ("de-DE", "en-US" or "en", for example) as a parameter upon receiving the culture value.

Syntax

<void> FormattingStyle.getCulture(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the culture as a languagecode2-country / regioncode2 string value.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates FormattingStyle.getCulture in a practical document-editing workflow. It gets the culture as a languagecode2-country / regioncode2 string value. Takes a callback function as a parameter which is called with a languagecode2-country / regioncode2 string ("de-DE", "en-US" or "en", for example) as a parameter upon receiving the culture value.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectCulture(formattingStyle) {
    formattingStyle.getCulture(
        function(result) {
            console.log("get culture result:", result);
        },
        onTxError
    );
}