22,985
edits
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
--Possibly may allow using without romanization (this is why I didn't remove Latin-script languages from the table) | |||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
Line 777: | Line 775: | ||
local originalText = args[2] | local originalText = args[2] | ||
local romanizedText = args[3] | local romanizedText = args[3] | ||
local meaning = args[6] | |||
local hideLabel = false | local hideLabel = false | ||
if args[5] ~= nil then --Note: hideLabel purposefully doesn't work for Simplified/Traditional Chinese case | if args[5] ~= nil then --Note: hideLabel purposefully doesn't work for Simplified/Traditional Chinese case | ||
Line 782: | Line 781: | ||
end | end | ||
local output = "" | local output = "" | ||
local function textWithMeaning(language,text,meaning) | |||
return string.format("<span lang=\"%s\" class=\"tooltip\">%s<span class=\"tooltiptext\">%s</span></span>",language,text,meaning) | |||
end | |||
if args[4] then | if args[4] then | ||
Line 788: | Line 790: | ||
romanizedText = args[4] | romanizedText = args[4] | ||
if language == "zh" then | if language == "zh" then | ||
output = string.format("%s: <span lang=\"zh-Hans\">%s</span>, %s: <span lang=\"zh-Hant\">%s</span>, romanized: ''%s''", wikipediaLink("zh-Hans"), script1Text, wikipediaLink("zh-Hant"), script2Text, romanizedText) | if args[6] then | ||
output = string.format("%s: %s, %s: %s, romanized: ''%s''", wikipediaLink("zh-Hans"), textWithMeaning("zh-Hans",script1Text,meaning), wikipediaLink("zh-Hant"), textWithMeaning("zh-Hant",script2Text,meaning), romanizedText) | |||
else | |||
output = string.format("%s: <span lang=\"zh-Hans\">%s</span>, %s: <span lang=\"zh-Hant\">%s</span>, romanized: ''%s''", wikipediaLink("zh-Hans"), script1Text, wikipediaLink("zh-Hant"), script2Text, romanizedText) | |||
end | |||
end | end | ||
else | else | ||
Line 794: | Line 800: | ||
output = wikipediaLink(language) .. ": " | output = wikipediaLink(language) .. ": " | ||
end | end | ||
output = output .. string.format("<span lang=\"%s\">%s</span>, romanized ''%s''",language,originalText,romanizedText) | if args[6] then | ||
output = output .. string.format("%s, romanized ''%s''",textWithMeaning(language,originalText,meaning),romanizedText) | |||
else | |||
output = output .. string.format("<span lang=\"%s\">%s</span>, romanized ''%s''",language,originalText,romanizedText) | |||
end | |||
end | end | ||
return output | return output |