# General Translation Python SDKs: get_locale
URL: https://generaltranslation.com/en-US/docs/python/reference/functions/get-locale.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Read the active locale for the current request in General Translation Python. API reference for get_locale.

Returns the locale resolved for the current request. It reads the value that locale detection stored on the active [`I18nManager`](/docs/python/reference/classes/i18n-manager).

## Overview [#overview]

Call `get_locale` with no arguments to get the current locale code.

```python
from gt_flask import get_locale  # or: from gt_fastapi import get_locale, or: from gt_i18n import get_locale

locale = get_locale()  # e.g. "es"
```

Signature:

```python
get_locale() -> str
```

*Note: It reads the active manager, so [`initialize_gt`](/docs/python/reference/functions/initialize-gt) (or [`set_i18n_manager`](/docs/python/reference/functions/set-i18n-manager)) must run first, otherwise it raises `RuntimeError`.*

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

- **Request-scoped.** It returns the locale stored by locale detection for the current request (via the manager's storage adapter).
- **Fallback.** It falls back to the default locale when no request locale is set.

## Parameters [#parameters]

`get_locale` takes no parameters.

## Returns [#returns]

**Type** `str`

The current locale code.

## Example [#example]

```python
from gt_flask import get_locale

locale = get_locale()  # e.g. "es"
```

## Sitemap

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