VS Code Extensions
next-intl Key Sorter

next-intl Key Sorter

by 221-BakerScript

Sort next-intl JSON translation keys recursively in alphabetical order.

Downloads

19

Rating

5.0 / 5 (1)

Version

0.2.1

Last updated

May 28, 2026

Sort next-intl JSON translation keys recursively in alphabetical order directly from VS Code.

This extension is useful when your translation files grow over time and become hard to scan, review, or diff in pull requests.

Features

  • Sort the current .json translation file.
  • Sort all translation files matching a configurable glob.
  • Recursively sort nested translation namespaces.
  • Keep arrays in their original order while sorting objects inside arrays.
  • Preserve unsaved editor content by applying VS Code text edits on open documents.
  • Configure indentation, final newline, case sensitivity and natural numeric ordering.

Commands

Open the Command Palette and run one of the following commands:

  • next-intl: Sort Current Translation File
  • next-intl: Sort All Translation Files

You can also right-click a .json file in the editor or explorer and run the current-file sort command.

Example

Before:

{
  "HomePage": {
    "title": "Home",
    "description": "Welcome"
  },
  "Auth": {
    "login": "Login",
    "register": "Register"
  }
}

After:

{
  "Auth": {
    "login": "Login",
    "register": "Register"
  },
  "HomePage": {
    "description": "Welcome",
    "title": "Home"
  }
}

Settings

{
  "nextIntlKeySorter.localesGlob": "{messages,locales,src/messages,src/locales,src/i18n}/**/*.json",
  "nextIntlKeySorter.excludeGlob": "**/{node_modules,.next,out,dist,build,coverage}/**",
  "nextIntlKeySorter.indentSize": 2,
  "nextIntlKeySorter.finalNewline": true,
  "nextIntlKeySorter.caseSensitive": false,
  "nextIntlKeySorter.numeric": true
}

Requirements

The extension expects valid JSON files. It does not currently support JSONC comments.

Development

npm install
npm run compile
npm run test

Then press F5 in VS Code to launch the Extension Development Host.

Package locally

npm run package

This produces a .vsix file that can be installed manually in VS Code.

Release notes

See CHANGELOG.md.

License

MIT. See LICENSE.

Related extensions