---
title: "paraglide"
description: "The preset for Paraglide JS. It reads m.key() message calls and messages/{locale}.json files."
canonical_url: "https://x18n.dev/presets/paraglide"
---
# paraglide

> The preset for Paraglide JS. It reads m.key() message calls and messages/\{locale}.json files.

The `paraglide` preset supports [Paraglide JS](https://paraglidejs.com/) from inlang.

## Detection

The preset applies when the project depends on `@inlang/paraglide-js`, `@inlang/paraglide-sveltekit`, `@inlang/paraglide-next`, `@inlang/paraglide-astro` or `@inlang/paraglide-vite`.

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

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

## Locale files

If your config has no `resources`, the preset uses `messages/{locale}.json`.

## Supported syntax

A message is a function on the `m` object. The name of the function is the key. The preset reads `.js`, `.ts`, JSX, Vue, Svelte and Astro files.

<!-- eslint-skip -->

```svelte [src/routes/+page.svelte]
<h1>{m.hello_world({ name: 'Ada' })}</h1>
<p>{m['page.intro']()}</p>
```

## Placeholders

Single braces: `{name}`.

## Extraction templates

| Kinds                                   | Template               | Imports                                       |
| --------------------------------------- | ---------------------- | --------------------------------------------- |
| `jsx-text`, `svelte-text`, `astro-text` | `{m['{key}']({args})}` | `import { m } from '$lib/paraglide/messages'` |
| `js-string`, `js-template`              | `m['{key}']({args})`   | `import { m } from '$lib/paraglide/messages'` |


## Sitemap

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