45,622
edits
No edit summary |
No edit summary Tag: Reverted |
||
Line 51: | Line 51: | ||
--[[ | --[[ | ||
if | if namespace == "Reconstruction" or lang:hasType("reconstructed") then | ||
error("Reconstructed languages and reconstructed terms cannot have usage examples, as we have no record of their use.") | error("Reconstructed languages and reconstructed terms cannot have usage examples, as we have no record of their use.") | ||
end | end | ||
Line 72: | Line 72: | ||
if not sc then | if not sc then | ||
sc = | sc = lang:findBestScript(usex) | ||
end | end | ||
Line 84: | Line 84: | ||
if substs then | if substs then | ||
--[=[ | |||
[[Special:WhatLinksHere/Template:tracking/quote/substs]] | |||
[[Special:WhatLinksHere/Template:tracking/usex/substs]] | |||
]=] | |||
if quote then | |||
require("Module:debug").track("quote/substs") | |||
else | |||
require("Module:debug").track("usex/substs") | |||
end | |||
local substs = mw.text.split(substs, ",") | local substs = mw.text.split(substs, ",") | ||
Line 92: | Line 102: | ||
end | end | ||
transliteration = lang:transliterate(subbed_usex, sc) | transliteration = (lang:transliterate(subbed_usex, sc)) | ||
-- If the language doesn't have capitalization and is specified in [[Module:usex/data]], then capitalize any sentences. | |||
if transliteration and mw.loadData("Module:usex/data").capitalize_sentences[lang:getCode()] then | |||
transliteration = mw.ustring.gsub(transliteration, "%f[^%z%p%s](.)(.-[%.%?!‽])", function(m1, m2) return mw.ustring.upper(m1) .. m2 end) | |||
end | |||
end | end | ||
Line 114: | Line 129: | ||
elseif lang:getCode() ~= "en" and lang:getCode() ~= "mul" and lang:getCode() ~= "und" then | elseif lang:getCode() ~= "en" and lang:getCode() ~= "mul" and lang:getCode() ~= "und" then | ||
-- add trreq category if translation is unspecified and language is not english, translingual or undetermined | -- add trreq category if translation is unspecified and language is not english, translingual or undetermined | ||
table.insert(categories, "Requests for translations of " .. lang:getCanonicalName() .. " usage examples") | if quote then | ||
table.insert(categories, "Requests for translations of " .. lang:getCanonicalName() .. " quotations") | |||
else | |||
table.insert(categories, "Requests for translations of " .. lang:getCanonicalName() .. " usage examples") | |||
end | |||
translation = "<small>(please add an English translation of this " .. example_type .. ")</small>" | translation = "<small>(please add an English translation of this " .. example_type .. ")</small>" | ||
end | end | ||
if usex then | if usex then | ||
usex = require("Module:links").embedded_language_links({term = usex, lang = lang, sc = sc}, false) | |||
local face | local face | ||
Line 130: | Line 147: | ||
end | end | ||
if not nocat and | if not nocat and namespace == "" or namespace == "Contionary" then | ||
if quote then | if quote then | ||
table.insert(categories, lang:getCanonicalName() .. " terms with quotations") | table.insert(categories, lang:getCanonicalName() .. " terms with quotations") | ||
Line 259: | Line 276: | ||
class = class .. " " .. added_class | class = class .. " " .. added_class | ||
end | end | ||
result = div(class, result) | result = (inline and span or div)(class, result) | ||
result = result .. require("Module:utilities | result = result .. require("Module:utilities").format_categories(categories, lang, sortkey) | ||
if noenum then | if noenum then | ||
result = "\n: " .. result | result = "\n: " .. result |