nabekou29
js-i18n.nvim
Lua

A Neovim plugin for the JavaScript library i18next

Last updated Apr 9, 2026
52
Stars
11
Forks
0
Issues
0
Stars/day
Attention Score
47
Language breakdown
Lua 82.7%
JavaScript 13.8%
Makefile 2.3%
TypeScript 1.2%
โ–ธ Files click to expand
README

js-i18n.nvim

js-i18n.nvim

English | ๆ—ฅๆœฌ่ชž(ๅŽŸๆ–‡|Original)


JavaScript/TypeScript i18n library support for Neovim. powered by nabekou29/js-i18n-language-server.

License: MIT GitHub Release tests

Supported Libraries

โœจ Features

  • Inline translation display -- See translation values directly in your code as virtual text
  • Translation diagnostics -- Detect missing and unused translation keys
  • Completion -- Auto-complete translation keys as you type
  • Hover -- View all translation values by hovering over a key
  • Go to definition -- Jump to the key definition in JSON translation files
  • Find references -- Find all usages of a translation key in source code
  • Edit translations -- Edit translation values from commands or code actions
  • Copy key -- Copy the translation key at cursor to clipboard
  • Delete unused keys -- Remove translation keys not referenced in code

Demo

i18next / react-i18next

i18next-screenshot

next-intl

next-intl-screenshot

โœ… Requirements

npm install -g js-i18n-language-server

Alternatively, you can skip the global install and use npx by setting the server command in your config:

opts = {
    server = {
      cmd = { "npx", "-y", "js-i18n-language-server" },
    },
  }

๐Ÿ“ฆ Installation

lazy.nvim

{
  "nabekou29/js-i18n.nvim",
  event = { "BufReadPre", "BufNewFile" },
  opts = {},
}

๐Ÿ“š Usage

Commands

  • :I18nSetLang [lang] - Sets the language. The set language is used for virtual text display and definition jumps.
  • :I18nEditTranslation [lang] - Edits the translation at the cursor position. If there is no matching translation for the key, a new translation is added.
If lang is omitted, the currently displayed language is used.
  • :I18nVirtualTextEnable - Enables the display of virtual text.
  • :I18nVirtualTextDisable - Disables the display of virtual text.
  • :I18nVirtualTextToggle - Toggles the display of virtual text.
  • :I18nCopyKey - Copies the translation key at the cursor position to the clipboard.
  • :I18nDeleteUnusedKeys - Deletes unused translation keys from the current JSON file.

โš™๏ธ Configuration

The default settings are as follows. For the complete list, refer to config.lua.

{
  -- Client-side (Neovim-specific) settings
  virt_text = {
    enabled = true,        -- Enable virtual text display
    format = ...,          -- Format function for virtual text
    conceal_key = false,   -- Hide keys and display only translations
    max_length = 0,        -- Max character length (0 = unlimited)
    max_width = 0,         -- Max display width (0 = unlimited)
  },

-- Server settings -- Can also be configured via .js-i18n.json file (which takes priority) server = { cmd = { "js-i18n-language-server" }, -- Server command translationfiles = { filepattern = "/{locales,messages}//*.json" }, key_separator = ".", namespace_separator = nil, default_namespace = nil, primary_languages = nil, required_languages = nil, optional_languages = nil, diagnostics = { unused_keys = true }, }, }

For server-side configuration details, see the js-i18n-language-server configuration docs.

Handling Flattened JSON

When using flattened JSON (e.g., { "some.deeply.nested.key": "value" }), you can handle it by setting key_separator to a character that is not normally used.

{
  server = {
    keyseparator = "?",  -- or "noseparate", or any character not included in your keys
  },
}

This will treat dot-separated keys as a single key instead of nested keys.

โฌ†๏ธ Migration from v0.x

v1.0 has been rewritten to use the external js-i18n-language-server.

Key Changes

  • Dependencies: nvim-lspconfig, nvim-treesitter, plenary.nvim, and jq are no longer required
  • Requirements: js-i18n-language-server must be installed
  • Configuration: Server-related settings have moved into the server table
Deprecated config keys are automatically converted and a warning is displayed.
-- v0.x
{
  primary_language = { "ja" },
  translation_source = { "*/locales/.json" },
  key_separator = ".",
}

-- v1.0 { server = { primary_languages = { "ja" }, translationfiles = { filepattern = "*/locales/.json" }, key_separator = ".", }, }

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท nabekou29/js-i18n.nvim ยท Updated daily from GitHub