⚠︎ This file is translated and updated by ChatGPT based on the original text.
js-i18n.nvim is a Neovim plugin that supports JavaScript i18n libraries.
[!WARNING] This plugin is still under development and is optimized for the developer's use cases.
{
"nabekou29/js-i18n.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
},
event = { "BufReadPre", "BufNewFile" },
opts = {}
}
: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.
:I18nDiagnosticEnable
- Enables the display of diagnostic information.
:I18nDiagnosticDisable
- Disables the display of diagnostic information.
:I18nDiagnosticToggle
- Toggles the display of diagnostic information.
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
},
}