docs: modify readme file

This commit is contained in:
JuanZoran
2023-01-10 23:37:26 +08:00
parent 01f5882b13
commit 17ffaf69c9
4 changed files with 122 additions and 58 deletions

View File

@@ -1,6 +1,6 @@
local M = {}
M.component = function(field)
M.component = function(field, max_size)
if field.translation then
local ref = {
{ '中文翻译', 'TransRef' }
@@ -12,8 +12,13 @@ M.component = function(field)
emptyline = true,
needformat = true,
}
local size = 0
for trans in vim.gsplit(field.translation, '\n', true) do
size = size + 1
table.insert(translations, trans)
if size == max_size then
break
end
end
return { ref, translations }