# General Translation Python SDKs: decode_msg
URL: https://generaltranslation.com/en-US/docs/python/reference/functions/decode-msg.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Extract the human-readable message from an encoded msg result in General Translation Python. API reference for decode_msg.

Extracts the interpolated, human-readable message from a string produced by [`msg`](/docs/python/reference/functions/msg). It returns the text before the encoded options payload.

## Overview [#overview]

Call `decode_msg` with an encoded [`msg`](/docs/python/reference/functions/msg) result. It splits at the last colon and returns the left-hand side. If there is no colon, it returns the input unchanged.

```python
from gt_i18n import decode_msg

decode_msg(encoded_message)
```

Signature:

```python
decode_msg(encoded_msg: str) -> str
```

Import `decode_msg` from `gt_i18n`. It is not re-exported by the framework packages.

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

- **Split at last colon.** An encoded [`msg`](/docs/python/reference/functions/msg) result has the form `{interpolated}:{base64options}`; `decode_msg` returns everything before the final colon.
- **Plain input.** With no colon, it returns the input as-is, so plain strings pass through unchanged.

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`encoded_msg`](#encoded-msg) | An encoded [`msg`](/docs/python/reference/functions/msg) result or a plain string. | `str` | No | — |

### `encoded_msg` [#encoded-msg]

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

The encoded [`msg`](/docs/python/reference/functions/msg) result (or plain string) to decode.

## Returns [#returns]

**Type** `str`

The interpolated message, or the input unchanged when it has no colon.

## Example [#example]

```python
from gt_i18n import msg, decode_msg

encoded = msg("Hi, {name}!", name="Bob")
decode_msg(encoded)      # "Hi, Bob!"
decode_msg("Plain text") # "Plain text"
```

## Sitemap

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