# language/utils

module

<a id="functions">

## Functions

<a id="function-parseLanguageAttribute">

### `parseLanguageAttribute( str ) → object` _(internal)_

Retrieves language properties converted to attribute value by the [stringifyLanguageAttribute](#function-stringifyLanguageAttribute) function.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-language/src/utils.ts#L46)

#### Parameters

* `str: string`

  The attribute value.

#### Returns

* `object`

  The object with properties:

  * languageCode - The language code in the ISO 639 format.
  * textDirection - The language text direction.

<a id="function-stringifyLanguageAttribute">

### `stringifyLanguageAttribute( languageCode, textDirection? ) → string` _(internal)_

Returns the language attribute value in a human-readable text format:

```
<languageCode>:<textDirection>
```

* `languageCode` - The language code used for the `lang` attribute in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
* `textDirection` - One of the following values: `rtl` or `ltr`, indicating the reading direction of the language.

See the [text part language configuration](module_core_editor_editorconfig-LanguageConfig.md#member-textPartLanguage) for more information about language properties.

If the `textDirection` argument is omitted, it will be automatically detected based on `languageCode`.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-language/src/utils.ts#L31)

#### Parameters

* `languageCode: string`

  The language code in the ISO 639-1 format.

* `textDirection?: LanguageDirection`

  The language text direction. Automatically detected if omitted.

#### Returns

* `string`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
