Skip to content

Commit

Permalink
add week translator
Browse files Browse the repository at this point in the history
  • Loading branch information
CNMan committed Jun 3, 2024
1 parent 6cf480b commit 77050c8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions sample/lua/week.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--[[
week_translator: 将 `week` 翻译为当前星期
--]]

local function translator(input, seg)
if (input == "week") then
if (os.date("%w") == "0") then
weekstr = ""
end
if (os.date("%w") == "1") then
weekstr = ""
end
if (os.date("%w") == "2") then
weekstr = ""
end
if (os.date("%w") == "3") then
weekstr = ""
end
if (os.date("%w") == "4") then
weekstr = ""
end
if (os.date("%w") == "5") then
weekstr = ""
end
if (os.date("%w") == "6") then
weekstr = ""
end
yield(Candidate("week", seg.start, seg._end, "".."星期"..weekstr.."","星期"))
yield(Candidate("week", seg.start, seg._end, os.date("%Y年%m月%d日").."".."星期"..weekstr.."","星期"))
yield(Candidate("week", seg.start, seg._end, os.date("%Y年%m月%d日").."".."星期"..weekstr..""..os.date("%H:%M:%S"),"星期"))
end
end

return translator

0 comments on commit 77050c8

Please sign in to comment.