# Javascript: FormattingStyle.getCulture Method

> 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.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 30.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: FormattingStyle.getCulture Method
- **422 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getculture-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getculture-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getculture-method/llms-full.txt

---

### 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

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

### Parameters

| Parameter | Description |
|---|---|
| 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.

```javascript
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
    );
}
```

---

## Nearby

- **Previous:** [Javascript: FormattingStyle.getCharacterSpacing Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getcharacterspacing-method/llms-full.txt)
- **Next:** [Javascript: FormattingStyle.getFontName Method](https://docs.textcontrol.com/ds-server/reference/javascript/formattingstyle/getfontname-method/llms-full.txt)
