# node: getLocaleProperties URL: https://generaltranslation.com/en-US/docs/node/api/get-locale-properties.mdx --- title: getLocaleProperties description: API reference for the getLocaleProperties function --- ## Overview The `getLocaleProperties` function returns metadata about a given locale, including its name, native name, language, region, and script information. ```js import { getLocaleProperties } from 'gt-node'; const props = getLocaleProperties('en-US'); console.log(props.name); // 'American English' ``` ## Reference ### Parameters | Parameter | Type | Description | | --- | --- | --- | | `locale` | `string` | A BCP 47 locale code (e.g., `'en-US'`, `'ja'`). When not provided, uses the current locale. | ### Returns A `LocaleProperties` object with the following fields: | Field | Type | Description | | --- | --- | --- | | `code` | `string` | The locale code (e.g., `'en-US'`). | | `name` | `string` | The English name of the locale (e.g., `'American English'`). | | `nativeName` | `string` | The name in the locale's own language (e.g., `'American English'`). | | `languageCode` | `string` | The language subtag (e.g., `'en'`). | | `languageName` | `string` | The English name of the language (e.g., `'English'`). | | `nativeLanguageName` | `string` | The language name in its own language (e.g., `'English'`). | | `nameWithRegionCode` | `string` | The locale name including region (e.g., `'English (US)'`). | | `nativeNameWithRegionCode` | `string` | The native locale name including region. | | `regionCode` | `string` | The region subtag (e.g., `'US'`). | | `regionName` | `string` | The English name of the region (e.g., `'United States'`). | | `nativeRegionName` | `string` | The region name in the locale's own language. | | `scriptCode` | `string` | The script subtag (e.g., `'Latn'`). | | `scriptName` | `string` | The English name of the script (e.g., `'Latin'`). | | `nativeScriptName` | `string` | The script name in the locale's own language. | | `maximizedCode` | `string` | The fully expanded locale code (e.g., `'en-Latn-US'`). | --- ## Examples ### Basic usage ```js title="handler.js" import { getLocaleProperties } from 'gt-node'; app.get('/api/locale-info', (req, res) => { const props = getLocaleProperties('ja'); res.json({ name: props.name, // 'Japanese' nativeName: props.nativeName, // '日本語' script: props.scriptName, // 'Japanese' }); }); ``` --- ## Notes - This function is synchronous — it does not need to be awaited. - Useful for building locale selectors or displaying locale metadata to users. ## Next steps - See [`getLocale`](/docs/node/api/get-locale) for the current request locale. - Learn more about [locale codes](/docs/core/locales).