# python: get_locale URL: https://generaltranslation.com/en-US/docs/python/api/get-locale.mdx --- title: get_locale description: API reference for the get_locale function --- ## Overview Returns the current locale as set by [`initialize_gt`](/docs/python/api/initialize-gt) middleware. ```python from gt_flask import get_locale # or from gt_fastapi import get_locale locale = get_locale() # e.g., "es" ``` ## Reference ### Returns `str` — the current locale code.