# node: getLocale URL: https://generaltranslation.com/en-US/docs/node/api/get-locale.mdx --- title: getLocale description: API reference for the getLocale function --- ## Overview The `getLocale` function returns the current locale for the active request context. ```js import { getLocale } from 'gt-node'; const locale = getLocale(); // 'en-US' ``` **Request Context Required:** `getLocale` must be called within a [`withGT`](/docs/node/api/with-gt) callback so it knows which locale to use. ## Reference ### Parameters None. ### Returns `string` — The current BCP 47 [locale code](/docs/core/locales) (e.g., `'en-US'`). --- ## Examples ### Basic usage ```js title="handler.js" import { withGT, getLocale } from 'gt-node'; app.use((req, res, next) => { const locale = req.headers['accept-language']?.split(',')[0] || 'en-US'; withGT(locale, () => { console.log(getLocale()); // 'en-US' next(); }); }); ``` --- ## Next steps - See [`getLocales`](/docs/node/api/get-locales) for the full list of supported locales. - See [`getLocaleProperties`](/docs/node/api/get-locale-properties) for locale metadata.