nabekou29 / js-i18n.nvim

A Neovim plugin for the JavaScript library i18next
MIT License
18 stars 2 forks source link
neovim neovim-plugin
English | 日本語(原文|Original)


⚠︎ This file is translated and updated by ChatGPT based on the original text.


🌐 js-i18n.nvim

GitHub Release tests

js-i18n.nvim is a Neovim plugin that supports JavaScript i18n libraries.

🚧 Status

[!WARNING] This plugin is still under development and is optimized for the developer's use cases.

✨ Features

Supported Libraries

i18next, react-i18next

i18next-screenshot

next-intl

next-intl-screenshot

✅ Requirements

📦 Installation

lazy.nvim

{
  "nabekou29/js-i18n.nvim",
  dependencies = {
    "neovim/nvim-lspconfig",
    "nvim-treesitter/nvim-treesitter",
    "nvim-lua/plenary.nvim",
  },
  event = { "BufReadPre", "BufNewFile" },
  opts = {}
}

📚 Usage

Commands

⚙️ Configuration

The default settings are as follows. For omitted parts, refer to config.lua.

{
  primary_language = {}, -- The default language to display (initial setting for displaying virtual text, etc.)
  translation_source = { "**/{locales,messages}/*.json" }, -- Pattern for translation resources
  detect_language = ..., -- Function to detect the language. By default, a function that detects the language heuristically from the file name is used.
  key_separator = ".", -- Key separator
  virt_text = {
    enabled = true, -- Enable virtual text display
    format = ..., -- Format function for virtual text
    conceal_key = false, -- Hide keys and display only translations
    fallback = false, -- Fallback if the selected virtual text cannot be displayed
    max_length = 0, -- Maximum length of virtual text. 0 means unlimited.
    max_width = 0, -- Maximum width of virtual text. 0 means unlimited. (`max_length` takes precedence.)
  },
  diagnostic = {
    enabled = true, -- Enable the display of diagnostic information
    severity = vim.diagnostic.severity.WARN, -- Severity level of diagnostic information
  },
}

⬆️ Roadmap