DS Server

Javascript: Selection.getCulture Method

Method|Introduced in 26.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 selection information from the server.

Syntax

<void> Selection.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 Selection.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 selection information from the server.

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

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