# General Translation Integrations: Metadata files
URL: https://generaltranslation.com/en-GB/docs/integrations/paraglide/reference/metadata-files.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: The files that hold the source code context of Paraglide JS messages. Reference for metadata files.

A metadata file sits next to a message file of the base locale and mirrors it: `messages/en.json` gets `messages/en.metadata.json`. It uses the [keyed metadata](/docs/cli/reference/keyed-metadata) format, so the CLI uploads it with the messages.

## Format [#format]

Each used message has a [`sourceCode`](/docs/cli/reference/keyed-metadata#source-code) field which lists the code around its usages, by source file. Paths are relative to the project root.

```json title="messages/en.json"
{
  "greeting": "Hello, {username}!",
  "legacy_banner": "Welcome back"
}
```

```json title="messages/en.metadata.json"
{
  "greeting": {
    "sourceCode": {
      "src/Header.tsx": [
        {
          "before": "import { m } from './paraglide/messages.js';\n…",
          "target": "  return <h1>{m.greeting({ username })}</h1>;",
          "after": "}\n…"
        }
      ]
    }
  }
}
```

`legacy_banner` is not used in the app, so it has no entry.

| Field    | Description                                                                                                                 | Type     |
| -------- | --------------------------------------------------------------------------------------------------------------------------- | -------- |
| `before` | The lines above the usage: 10 by default, set by [`radius`](/docs/integrations/paraglide/reference/collect-context#radius). | `string` |
| `target` | The lines of the usage itself.                                                                                              | `string` |
| `after`  | The lines below the usage.                                                                                                  | `string` |

## Which files and keys are written [#written]

* **Base locale only.** Other locales&#39; files, such as `messages/fr.json`, get no metadata file: the context is the same for every target language.
* **Message file keys only.** Only keys the message file has are written, because the CLI rejects a metadata key the source file lacks. Nested keys stay nested.
* **Used messages only.** An unused message has no entry.
* **Dynamic names.** A computed name such as ``m[`error_${code}`]`` goes to every message matching `error_*`. `m[key]` alone goes to none.
* **Several inlang projects.** A usage goes to the project its Paraglide JS output directory was compiled from.

Message files are read from each inlang project&#39;s `settings.json`: its `baseLocale` and the `pathPattern` of `plugin.inlang.messageFormat`.

## How files are updated [#updates]

* `sourceCode` is replaced on every run. Fields you write by hand, [`context`](/docs/cli/reference/keyed-metadata#context) and [`maxChars`](/docs/cli/reference/keyed-metadata#max-chars), are kept.
* A file is written atomically, and only when its content changes.
* A metadata file that cannot be read, or that is not a JSON object, is left as it is, with a warning.
* A project that no longer imports Paraglide JS keeps its metadata files as they are: its output directory, and so its inlang project, is not found.

## Limits [#limits]

* Apps that share one inlang project overwrite each other&#39;s `sourceCode`. The last one analysed wins.
* Messages stored by other inlang format plugins, such as i18next, get no metadata file.
* The translation service reads a limited number of entries per file and truncates long ones. (See [`sourceCode`](/docs/cli/reference/keyed-metadata#source-code)).

## Sitemap

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