> ## Documentation Index
> Fetch the complete documentation index at: https://hyperlocalise.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Translate JSONC localization files with Hyperlocalise

> Translate JSON with comments and understand canonical JSON writeback.

JSONC adds comments and trailing commas to JSON. Use this guide for message catalogs with that syntax; Hyperlocalise can read them, but its JSON writeback does not preserve comments or trailing commas.

Supported extensions: `.jsonc`.

## Source file

Save this example as `locales/en-US/messages.jsonc`.

```jsonc theme={null}
{
    // Home screen
    "title": "Welcome",
}
```

## Configure your files

Use this `i18n.yml` for the example, or add its file mapping to your existing bucket.
See [path templates](/cli/configuration/path-templates) for other layouts.

```yaml theme={null}
locales:
    source: en-US
    targets:
        - es-ES

buckets:
    messages:
        files:
            - from: locales/en-US/messages.jsonc
              to: locales/{{target}}/messages.jsonc

llm:
    profiles:
        default:
            provider: openai
            model: gpt-5.2
```

## Translate

[Install the CLI](/cli/getting-started/install) and set `OPENAI_API_KEY` in your
project's `.env.local` or shell. You can also configure another
[AI provider](/cli/providers/overview).

```bash theme={null}
hyperlocalise run --dry-run
hyperlocalise run
```

The dry run previews the work. The second command writes translations to the
configured target path and updates the lockfile.

## Behavior and limitations

* Accepts line comments, block comments, and trailing commas. Message extraction follows the JSON rules.

* Translation leaves must be strings, including values inside nested objects and arrays.

* Writeback uses the JSON output path. Do not rely on comments, trailing commas, or original formatting being preserved.

## Next steps

* [Check translations](/cli/commands/check) before committing generated files.
* [Local translation workflow](/cli/workflows/local-generation) explains repeat runs.
* [Browse all file formats](/cli/reference/formats/overview).

## Related formats

* [JSON localization](/cli/reference/formats/json)
* [JavaScript and TypeScript locale](/cli/reference/formats/javascript-typescript)
