Jump to content

Module talk:etymology

Page contents not supported in other languages.
បន្ថែម​ប្រធានបទ​
ពីWiktionary

local export = {}

function export.format_etyl(lang, source, sort_key) local info

if source:getCode() == "und" then info = { display = "undetermined", cat_name = "other languages"} elseif source:getType() == "etymology language" then info = { display = "" .. source:getCanonicalName() .. "", cat_name = source:getCanonicalName()} elseif source:getType() == "family" then info = { display = "" .. source:getCanonicalName() .. "", cat_name = source:getCategoryName()} else info = { display = "" .. source:getCanonicalName() .. "", cat_name = source:getCanonicalName()} end

-- Add the categories, but only if there is a current language local categories = ""

if lang then local m_utilities = require("Module:utilities")

categories = {}

if lang:getCode() == source:getCode() or (source:getType() == "etymology language" and lang:getCode() == source:getParentCode()) then categories = m_utilities.format_categories({lang:getCanonicalName() .. " twice-borrowed terms"}, lang, sort_key) else categories = m_utilities.format_categories({"បច្ចេកសព្ទ" .. lang:getCanonicalName() .. "បានមកពី" .. info.cat_name}, lang, sort_key) end end

return "" .. info.display .. categories .. "" end

-- Internal implementation of Lua error in Module:etymology/templates at line 28: The language, family or etymology language code "..." is not valid.. and Lua error in Module:etymology/templates at line 28: The language, family or etymology language code "..." is not valid.. templates function export.format_cognate(terminfo, sort_key) return export.format_derived(nil, terminfo, sort_key) end

-- Internal implementation of Lua error in Module:etymology/templates/internal at line 63: The parameters "2" are required.. and Lua error in Module:etymology/templates/internal at line 63: The parameters "2" are required.. templates function export.format_derived(lang, terminfo, sort_key) local source = terminfo.lang

if not (terminfo.lang:getType() == "regular" or terminfo.lang:getType() == "reconstructed" or terminfo.lang:getType() == "etymology language") then if terminfo.term then error("A term was provided but the given code \"" .. terminfo.lang:getCode() .. "\" is not a language, and therefore cannot have terms or dictionary entries.") else terminfo.term = "-" end end

if terminfo.lang:getType() == "etymology language" then local parent = require("Module:languages").getByCode(terminfo.lang:getParentCode()) or require("Module:families").getByCode(terminfo.lang:getParentCode())

if not (parent:getType() == "regular" or parent:getType() == "reconstructed" or parent:getType() == "etymology language") then if terminfo.term then error("A term was provided but the given code \"" .. terminfo.lang:getCode() .. "\" is not a language, and therefore cannot have terms or dictionary entries.") else terminfo.term = "-" end end

terminfo.lang = parent end

local link = ""

if terminfo.term ~= "-" then link = " " .. require("Module:links").full_link(terminfo, "term", true) end

return export.format_etyl(lang, source, sort_key) .. link end

-- Internal implementation of Lua error in Module:etymology/templates at line 154: The parameters "2" are required.. and Lua error in Module:etymology/templates at line 154: The parameters "2" are required.. templates function export.format_inherited(lang, terminfo, sort_key) local source = terminfo.lang

if not (terminfo.lang:getType() == "regular" or terminfo.lang:getType() == "reconstructed" or terminfo.lang:getType() == "etymology language") then if terminfo.term then error("A term was provided but the given code \"" .. terminfo.lang:getCode() .. "\" is not a language, and therefore cannot have terms or dictionary entries.") else terminfo.term = "-" end end

if terminfo.lang:getType() == "etymology language" then local parent = require("Module:languages").getByCode(terminfo.lang:getParentCode()) or require("Module:families").getByCode(terminfo.lang:getParentCode())

if not (parent:getType() == "regular" or parent:getType() == "reconstructed" or parent:getType() == "etymology language") then if terminfo.term then error("A term was provided but the given code \"" .. terminfo.lang:getCode() .. "\" is not a language, and therefore cannot have terms or dictionary entries.") else terminfo.term = "-" end end

terminfo.lang = parent end

if not lang:hasAncestor(terminfo.lang) and mw.title.getCurrentTitle().nsText ~= "Template" then error(terminfo.lang:getCanonicalName() .. " is not an ancestor of " .. lang:getCanonicalName() .. ".") end

local link = ""

if terminfo.term ~= "-" then link = " " .. require("Module:links").full_link(terminfo, "term", true) end

local categories = require("Module:utilities").format_categories({"បច្ចេកសព្ទ" .. lang:getCanonicalName() .. "បានមកពី" .. source:getCanonicalName()}, lang, sort_key) categories = categories .. require("Module:utilities").format_categories({"បច្ចេកសព្ទ" .. lang:getCanonicalName() .. "បានស្នងពី" .. source:getCanonicalName()}, lang, sort_key)

return export.format_etyl(nil, source, sort_key) .. link .. categories end

-- Internal implementation of ទំព័រគំរូ:borrowed and Lua error in Module:etymology/templates at line 154: The parameters "2" are required.. templates function export.format_borrowed(lang, terminfo, sort_key, nocap, notext, learned) if nocap then require("Module:debug").track("bor/nocap") end

local source = terminfo.lang

if not (terminfo.lang:getType() == "regular" or terminfo.lang:getType() == "reconstructed" or terminfo.lang:getType() == "etymology language") then if terminfo.term then error("A term was provided but the given code \"" .. terminfo.lang:getCode() .. "\" is not a language, and therefore cannot have terms or dictionary entries.") else terminfo.term = "-" end end

if terminfo.lang:getType() == "etymology language" then local parent = require("Module:languages").getByCode(terminfo.lang:getParentCode()) or require("Module:families").getByCode(terminfo.lang:getParentCode())

if not (parent:getType() == "regular" or parent:getType() == "reconstructed" or parent:getType() == "etymology language") then if terminfo.term then error("A term was provided but the given code \"" .. terminfo.lang:getCode() .. "\" is not a language, and therefore cannot have terms or dictionary entries.") else terminfo.term = "-" end end

terminfo.lang = parent end

local text = "" local categories = {}

if lang:getCode() == terminfo.lang:getCode() then table.insert(categories, lang:getCanonicalName() .. " twice-borrowed terms") elseif source:getType() == "family" then table.insert(categories, lang:getCanonicalName() .. " terms derived from " .. source:getCategoryName()) table.insert(categories, lang:getCanonicalName() .. " terms borrowed from " .. source:getCategoryName()) else table.insert(categories, "បច្ចេកសព្ទ" .. lang:getCanonicalName() .. "បានមកពី" .. source:getCanonicalName()) table.insert(categories, "បច្ចេកសព្ទ" .. lang:getCanonicalName() .. "ខ្ចីពី" .. source:getCanonicalName()) end

if learned then text = "" .. (nocap and "l" or "L") .. "earned borrowing from " table.insert(categories, lang:getCanonicalName() .. " learnedly borrowed terms") else text = "" .. (nocap and "ខ" or "ខ") .. "្ចីពី" end

local link = ""

if terminfo.term ~= "-" then link = " " .. require("Module:links").full_link(terminfo, "term", true) end

categories = require("Module:utilities").format_categories(categories, lang, sort_key)

return (notext and "" or text) .. export.format_etyl(nil, source, sort_key) .. link .. categories end

-- Internal implementation of Lua error in Module:etymology/templates at line 154: The parameters "2" are required.. template function export.calque(lang, terminfo, parts, sort_key, nocap, notext) local result = ""

if parts and #parts ~= 0 then result = result .. require("Module:compound").show_compound(lang, nil, parts) result = result .. ", សព្ទត្រាប់សព្ទ" result = result .. " " elseif not notext then result = result .. "" .. (nocap and "c" or "C") .. "alque of " end

local categories = require("Module:utilities").format_categories({"សព្ទត្រាប់សព្ទ" .. lang:getCanonicalName()}, lang, sort_key)

result = result .. " " .. export.format_borrowed(lang, terminfo, sort_key, false, true, false) .. categories

return result end

return export

Start a discussion about Module:etymology

Start a discussion