Module:Lang-zh and Module:Lang-zh/sandbox: Difference between pages
(Difference between pages)
imported>Jonesey95 migrate change from sandbox after testing; stop stripping italic and bold markup inserted via ' characters. See talk page. |
imported>Jonesey95 don't strip valid italic markup from end of l= |
||
| Line 29: | Line 29: | ||
["poj"] = "Pe̍h-ōe-jī", | ["poj"] = "Pe̍h-ōe-jī", | ||
["tl"] = "Tâi-lô", | ["tl"] = "Tâi-lô", | ||
["wgn"] = "Wugniu", | |||
["zhu"] = "Zhuyin Fuhao", | ["zhu"] = "Zhuyin Fuhao", | ||
["l"] = "lit.", | ["l"] = "lit.", | ||
| Line 47: | Line 48: | ||
["poj"] = "Pe̍h-ōe-jī", | ["poj"] = "Pe̍h-ōe-jī", | ||
["tl"] = "Tâi-uân Lô-má-jī Phing-im Hong-àn", | ["tl"] = "Tâi-uân Lô-má-jī Phing-im Hong-àn", | ||
["wgn"] = "Romanization of Wu Chinese", | |||
["zhu"] = "Bopomofo", | ["zhu"] = "Bopomofo", | ||
["l"] = "Literal translation", | ["l"] = "Literal translation", | ||
| Line 63: | Line 65: | ||
["cy"] = "yue-Latn", | ["cy"] = "yue-Latn", | ||
["sl"] = "yue-Latn", | ["sl"] = "yue-Latn", | ||
["poj"] = "nan-Latn", | ["poj"] = "nan-Latn-pehoeji", | ||
["tl"] = "nan-Latn-tailo", | ["tl"] = "nan-Latn-tailo", | ||
["wgn"] = "wuu-Latn", | |||
["zhu"] = "zh-Bopo", | ["zhu"] = "zh-Bopo", | ||
} | } | ||
| Line 77: | Line 80: | ||
["poj"] = true, | ["poj"] = true, | ||
["tl"] = true, | ["tl"] = true, | ||
["wgn"] = true, | |||
} | } | ||
| Line 82: | Line 86: | ||
["w"] = true, | ["w"] = true, | ||
["sl"] = true, | ["sl"] = true, | ||
["wgn"] = true, | |||
} | } | ||
| Line 109: | Line 114: | ||
local usebrackets = 0 -- whether to have bracketed terms | local usebrackets = 0 -- whether to have bracketed terms | ||
local numargs = 0 | local numargs = 0 | ||
local | local regionalVariant = nil | ||
if args["out"] then | if args["out"] then | ||
| Line 119: | Line 124: | ||
local j1 = false -- whether Cantonese Romanisations go first | local j1 = false -- whether Cantonese Romanisations go first | ||
local poj1 = false -- whether Hokkien Romanisations go first | local poj1 = false -- whether Hokkien Romanisations go first | ||
local wgn1 = false -- whether Wugniu goes first | |||
local testChar | local testChar | ||
if (args["first"]) then | if (args["first"]) then | ||
| Line 130: | Line 136: | ||
if (testChar == "poj") then | if (testChar == "poj") then | ||
poj1 = true | poj1 = true | ||
end | |||
if (testChar == "wgn") then | |||
wgn1 = true | |||
end | end | ||
end | end | ||
| Line 139: | Line 148: | ||
-- based on setting/preference specify order | -- based on setting/preference specify order | ||
local orderlist = {"c", "s", "t", "p", "tp", "w", "j", "cy", "sl", "poj", "tl", "zhu", "l", "tr"} | local orderlist = {"c", "s", "t", "p", "tp", "w", "j", "cy", "sl", "poj", "tl", "wgn", "zhu", "l", "tr"} | ||
if (t1) then | if (t1) then | ||
orderlist[2] = "t" | orderlist[2] = "t" | ||
| Line 161: | Line 170: | ||
orderlist[10] = "cy" | orderlist[10] = "cy" | ||
orderlist[11] = "sl" | orderlist[11] = "sl" | ||
end | |||
if (wgn1) then | |||
orderlist[4] = "wgn" | |||
orderlist[5] = "p" | |||
orderlist[6] = "tp" | |||
orderlist[7] = "w" | |||
orderlist[8] = "j" | |||
orderlist[9] = "cy" | |||
orderlist[10] = "sl" | |||
orderlist[11] = "poj" | |||
orderlist[12] = "tl" | |||
end | end | ||
| Line 169: | Line 189: | ||
end | end | ||
if args["tp"] then | if args["tp"] then | ||
-- if also | -- if also Tongyong pinyin use full name for Hanyu pinyin | ||
labels["p"] = "Hanyu Pinyin" | labels["p"] = "Hanyu Pinyin" | ||
end | end | ||
| Line 176: | Line 196: | ||
if args["t_hk"] then | if args["t_hk"] then | ||
args["t"] = args["t_hk"] | args["t"] = args["t_hk"] | ||
regionalVariant = "HK" | |||
elseif args["t_tw"] then | elseif args["t_tw"] then | ||
args["t"] = args["t_tw"] | args["t"] = args["t_tw"] | ||
regionalVariant = "TW" | |||
end | end | ||
| Line 242: | Line 262: | ||
if (ISOlang[part]) then | if (ISOlang[part]) then | ||
-- add span for language if needed | -- add span for language if needed | ||
params = {["lang"] = ISOlang[part] .. ( | params = {["lang"] = ISOlang[part] .. (regionalVariant and "-" .. regionalVariant or "")} | ||
val = mw.text.tag({name="span",attrs=params, content=val}) | val = mw.text.tag({name="span",attrs=params, content=val}) | ||
elseif (part == "l") then | elseif (part == "l") then | ||