nvimdev / nvimdev/lspsaga.nvim

Internationalization

Open
#1,505 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
3.8k
Forks
308
PR merge metrics
No merged PRs in 30d

Description

First of all great job on developing this plugin.

Feauture

I will like for their to either be a way for me to change the name of titles like references, code actions, etc. so I can add my translations.

Or if this plugin had translations in it it will be great.

Reason

I am currently working on adding internationalization in my own setup , most so I can practice Japanese and not bother other people who might want it in english.

My Approach

I am getting the texts from plugins to exchange them with text that will be translated depending the vim language set.

To get the language set I am using a variable build in which Is

vim.v.lang

Once I get the language it changes the values depending on the languages available and translations.
For me I used a function that when text goes inside It tries to look for an available translation. if it doesnt have then it returns default string.

-- Current Language
local lang = string.sub(vim.v.lang, 1, 2)
-- Translations
local file = io.open(vim.fn.stdpath('config').."/lua/andrem222/lang/"..lang..".json", "rb")
-- Decoded translations
local jsonFile

-- Check if translation available to decode
if file then
    jsonFile = vim.json.decode(file:read("*a"))

    file:close()
end

--- This function returns the translation if available of text in the parameter
--- @param description string Description to translate
--- @return any
function Msgstr(description)
    if not jsonFile then return description end
    if not jsonFile[description] or jsonFile[description]["msgstr"] == '' then return description end

    return jsonFile[description]["msgstr"]
end

NVim Approach

They instead used a cmakelist to get translations and exchange them using gettext.
This one might be better but I am still not knowledgable about that and I'm trying to learn it now to see how to make it work.

https://github.com/neovim/neovim/blob/master/src/nvim/po/CMakeLists.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue's proposed use of vim.v.lang and the Neovim translation approach in src/nvim/po/CMakeLists.txt. Determine which lspsaga text should be translatable and whether the project wants user-supplied translations or bundled gettext support. Done means an agreed translation mechanism with fallback behavior and documented scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
internationalization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.