---
title: "globalize"
description: "The preset for Globalize. It reads formatMessage and messageFormatter calls with paths such as greetings/hello."
canonical_url: "https://x18n.dev/presets/globalize"
---
# globalize

> The preset for Globalize. It reads formatMessage and messageFormatter calls with paths such as greetings/hello.

The `globalize` preset supports [Globalize](https://github.com/globalizejs/globalize).

## Detection

The preset applies when the project depends on `globalize`.

```ts [x18n.config.ts]
import { defineConfig } from '@x18n/core'

export default defineConfig({
  presets: ['globalize'],
})
```

## Locale files

The preset adds no resource patterns. Set `resources` in the config, or let x18n guess the locale directories.

## Supported syntax

These names count as translate calls: `Globalize.formatMessage`, `Globalize.messageFormatter`, `globalize.formatMessage` and `globalize.messageFormatter`.

Globalize separates the segments of a message path with a slash. The preset turns each slash into a dot, so this call is a usage of the key `a.b`:

```js [src/a.js]
Globalize.formatMessage('a/b')
```

## Placeholders

ICU MessageFormat, as for [next-intl](https://x18n.dev/presets/next-intl#placeholders).

## Extraction templates

| Kinds                      | Template                                 |
| -------------------------- | ---------------------------------------- |
| `js-string`, `js-template` | `Globalize.formatMessage('{key}'{args})` |


## Sitemap

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