# General Translation Changelog: gt-node 0.3.0: ロケールユーティリティ関数
URL: https://generaltranslation.com/ja/blog/gt-node_v0_3_0.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 
Authors: Ernest McCarter
Published: 2026-03-09

## 概要

`gt-node` で、ロケール用ユーティリティ関数 [`getLocale()`](/docs/node/reference/functions/get-locale), [`getDefaultLocale()`](/docs/node/reference/functions/get-default-locale), [`getLocales()`](/docs/node/reference/functions/get-locales), [`getLocaleProperties()`](/docs/node/reference/functions/get-locale-properties) がエクスポートされるようになりました。

これらの関数は、すでに `gt-next` と `gt-react` には存在していました。`gt-node` にも追加されたことでサーバー側でも機能が揃い、i18n マネージャーを直接参照しなくてもロケール情報にアクセスできるようになりました。

## 新機能

### `getLocale()`

現在のリクエストのロケールを返します。

```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()); // 'es'
    next();
  });
});
```


### `getDefaultLocale()`

[`initializeGT`](/docs/node/reference/functions/initialize-gt) で設定されたデフォルトのロケールを返します。

```js
import { getDefaultLocale } from 'gt-node';

console.log(getDefaultLocale()); // 'en-US'
```

### `getLocales()`

サポートされているロケールの一覧を返します。

```js
import { getLocales } from 'gt-node';

console.log(getLocales()); // ['en-US', 'es', 'fr']
```


### `getLocaleProperties()`

ロケールのメタデータ (名称、現地語名、地域、文字体系など) を返します。

```js
import { getLocaleProperties } from 'gt-node';

const props = getLocaleProperties('ja');
console.log(props.nativeName); // '日本語'
```

## Sitemap

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