Content deleted Content added
documented parameter is "no" |
sync from sandbox: include explicitly given script subtag in language tagging |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1:
require('
local m_data = mw.loadData("Module:
local langData = m_data.languages or m_data
Line 11:
return value
end
end
Line 61 ⟶ 54:
end
end
local function fixScriptCode(firstLetter, threeLetters)
Line 68 ⟶ 59:
end
local function getCodes(codes
local languageCode, scriptCode, invalidCode
local errorText
Line 127 ⟶ 118:
else
errorText = '<code>'..codes..'</code> is not a valid language or script code.'
scriptCode = require("Module:Unicode data").is_Latin(text) and "Latn" or "unknown"▼
end
if errorText then
Line 140 ⟶ 128:
end
local function tag(text, languageCode, script,
local data = langData[languageCode]
-- Use Wikipedia code if it has been given: for instance,
Line 146 ⟶ 134:
-- code "ine-x-proto".
languageCode = data and data.Wikipedia_code or languageCode
languageCode = languageCode .. "-" .. script
end
if not text then text = "[text?]" end
Line 165 ⟶ 154:
return table.concat(out)
end
Line 197 ⟶ 169:
error("Name for the language code " .. ("%q"):format(languageCode or nil)
.. " could not be retrieved with mw.language.fetchLanguageName, "
.. "so it should be added to [[Module:
end
end
Line 245 ⟶ 217:
local word2 = ifNotEmpty(args[3])
if not args[2] or '' == args[2] then
end
local languageCode, scriptCode, errorText = getCodes(codes
local italics = args.italics or args.i or args.italic
italics = not (italics == "n" or italics == "-" or italics == "no")
Line 262 ⟶ 234:
linkText = word1
end
▲
local out
if languageCode and entry and linkText then
out = tag(linkToWiktionary(entry, linkText, languageCode), languageCode, scriptCode,
elseif entry and linkText then
out = linkToWiktionary(entry, linkText)
Line 276 ⟶ 250:
else
return errorText or error("The function wiktlang generated nothing")
▲ if word2 and word1 then
end
end
|