# General Translation Python SDKs: decode_vars
URL: https://generaltranslation.com/en-US/docs/python/reference/functions/decode-vars.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Replace General Translation variable markers in a string with their values in Python. API reference for decode_vars.

Replaces `{_gt_, select, other {value}}` variable markers in an ICU string with their embedded values. Use it to recover the plain, filled-in string from one built with [`declare_var`](/docs/python/reference/functions/declare-var).

## Overview [#overview]

Call `decode_vars` with an ICU string that may contain General Translation variable markers. It returns the string with each marker replaced by its embedded value.

```python
from gt_i18n import declare_var, decode_vars

marked = f"Signed in as {declare_var('a@b.com', name='email')}"
decode_vars(marked)  # "Signed in as a@b.com"
```

Signature:

```python
decode_vars(icu_string: str) -> str
```

Re-exported from `generaltranslation.static` by `gt_i18n` and the framework packages.

## How it works [#how-it-works]

- **Fast path.** If the string contains no `_gt_` marker, it is returned unchanged.
- **Marker expansion.** It traverses the ICU AST, finds unindexed `_gt_` selects, and replaces each with the value from its `other` clause (an empty string when absent).

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`icu_string`](#icu-string) | An ICU MessageFormat string potentially containing variable markers. | `str` | No | — |

### `icu_string` [#icu-string]

**Type** `str` · **Required**

An ICU MessageFormat string potentially containing General Translation variable markers.

## Returns [#returns]

**Type** `str`

The string with variable markers replaced by their embedded values.

## Example [#example]

```python
from gt_i18n import declare_var, decode_vars

marked = f"You have {declare_var('5', name='count')} messages"
decode_vars(marked)  # "You have 5 messages"
```

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
