Module:etymology: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 60: Line 60:
end
end


local langname = lang:getFullName()
local langname = lang:getCanonicalName()
-- If `lang` is an etym-only language, we need to check both it and its parent full language against `source`.
-- If `lang` is an etym-only language, we need to check both it and its parent full language against `source`.
-- Otherwise if e.g. `lang` is Medieval Latin and `source` is Latin, we'll end up wrongly constructing a
-- Otherwise if e.g. `lang` is Medieval Latin and `source` is Latin, we'll end up wrongly constructing a
-- category 'Latin terms derived from Latin'.
-- category 'Latin terms derived from Latin'.
if lang:getCode() == source:getCode() or lang:getFullCode() == source:getCode() then
if lang:getCode() == source:getCode() or lang:getCode() == source:getCode() then
table.insert(categories, langname .. " terms borrowed back into " .. langname)
table.insert(categories, langname .. " terms borrowed back into " .. langname)
else
else
Line 124: Line 124:
local etymModuleLink = lang:hasType("etymology-only") and "[[Module:etymology languages/data]] or " or ""
local etymModuleLink = lang:hasType("etymology-only") and "[[Module:etymology languages/data]] or " or ""
local moduleLink = "[[Module:"
local moduleLink = "[[Module:"
.. require("Module:languages").getDataModuleName(lang:getFullCode())
.. require("Module:languages").getDataModuleName(lang:getCode())
.. "]]"
.. "]]"
if not ancestors[1] then
if not ancestors[1] then
Line 150: Line 150:
local categories = {}
local categories = {}
if not nocat then
if not nocat then
table.insert(categories, lang:getFullName() .. " terms inherited from " .. source:getCanonicalName())
table.insert(categories, lang:getCanonicalName() .. " terms inherited from " .. source:getCanonicalName())
end
end


Line 164: Line 164:
local category
local category
-- Do the same check as in insert_source_cat_get_display() (inverted).
-- Do the same check as in insert_source_cat_get_display() (inverted).
if not (lang:getCode() == source:getCode() or lang:getFullCode() == source:getCode()) then
if not (lang:getCode() == source:getCode() or lang:getCode() == source:getCode()) then
-- If both are the same, we want e.g. [[:Category:English terms borrowed back into English]] not
-- If both are the same, we want e.g. [[:Category:English terms borrowed back into English]] not
-- [[:Category:English terms borrowed from English]]; the former is inserted automatically by format_etyl().
-- [[:Category:English terms borrowed from English]]; the former is inserted automatically by format_etyl().
Line 170: Line 170:
end
end
if category then
if category then
table.insert(categories, lang:getFullName() .. category)
table.insert(categories, lang:getCanonicalName() .. category)
end
end
end
end

Navigation menu