模組:zh-generateforms
呢個模組嘅解說可以喺模組:zh-generateforms/doc度開
local export = {}
function export.generateForms(text, lang, sc)
if sc ~= "Hant" then
return {text}
else
local data = require("Module:zh/data/ts/serialized")
local data_len = data:len()
local trad = text
local simp = text:gsub("[\194-\244][\128-\191]*", function(char)
local loc = data:sub(1, data_len / 2):find(char)
if loc then
return data:sub(data_len / 2 + 1):sub(loc, loc + 3):gsub("%z", "")
else
return char
end
end)
return {trad, simp}
end
end
return export