মডিউল:etymology/specialized
এই মডিউলের জন্য মডিউল:etymology/specialized/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
local m_str_utils = require("Module:string utilities")
local gsub = m_str_utils.gsub
local insert = table.insert
local pluralize = m_str_utils.pluralize
local upper = m_str_utils.upper
local export = {}
-- This function handles all the messiness of different types of specialized borrowings. It should insert any
-- borrowing-type-specific categories into `categories` unless `nocat` is given, and return the text to display
-- before the source + term (or "" for no text).
function export.get_specialized_borrowing_text_insert_cats(bortype, categories, lang, term, source, nocap, nocat, senseid)
local function inscat(cat)
-- এই ফাংশনটি ক্যাটেগরিতে "ক থেকে ঋণকৃত খ শব্দ" ধরনের বিষয়শ্রেণী যুক্ত করবে।
-- উদাহরণস্বরূপ দেখুন [[কম্পিউটার]] ভুক্তিটি, যেখানে [[বিষয়শ্রেণী:ইংরেজি থেকে ঋণকৃত বাংলা শব্দ]] বিষয়শ্রেণীটি যুক্ত হয়েছে।
-- এখানে,
-- sourcedisp = যে ভাষা থেকে আসবে সে ভাষার নাম
-- getCanonicalName = যে ভাষায় এসেছে সেটির নাম
if not nocat then
local sourcedisp = source:getDisplayForm()
if cat:find("SOURCE") then
cat = cat:gsub("SOURCE", sourcedisp)
else
cat = sourcedisp .. " " .. cat
end
insert(categories, cat .. " " .. lang:getCanonicalName() .. " শব্দ")
end
end
-- `text` is the display text for the borrowing type, which gets converted
-- into a link.
-- `appendix` is a the glossary anchor, which defaults to `text`
-- `prep` is the preposition between the borrowing type and the language
-- name (e.g. "of", "from")
-- `pos` is the part of speech for the borrowing type ("noun" or
-- "adjective"; defaults to "noun")
-- `plural` is the plural form of the borrowing type; if not specified,
-- the pluralize function is used
local text, appendix, prep, pos, plural
if bortype == "calque" then
text, prep = "আক্ষরিক অনুবাদ", "-এর"
inscat("terms calqued from")
elseif bortype == "partial-calque" then
text, prep = "partial calque", "of"
inscat("terms partially calqued from")
elseif bortype == "semantic-loan" then
text, prep = "semantic loan", "from"
inscat("semantic loans from")
elseif bortype == "transliteration" then
text, prep = "প্রতিবর্ণ", "-এর"
inscat("terms borrowed from")
inscat("transliterations of SOURCE terms")
elseif bortype == "phono-semantic-matching" then
text, prep = "phono-semantic matching", "of"
inscat("phono-semantic matchings from")
else
local langcode = lang:getCode()
local lang_is_source = langcode == source:getCode()
if lang_is_source then
-- Track, because this shouldn't be happening. A language can only have itself as a source further up the chain after a borrowing, which is always "derived".
require("Module:debug/track"){
"etymology/specialized/self-as-source",
"etymology/specialized/self-as-source/" .. langcode
}
inscat("terms borrowed back into")
else
inscat("থেকে ঋণকৃত")
if bortype ~= "borrowing" then
inscat(bortype .. " থেকে ঋণকৃত ")
end
end
if bortype == "borrowing" then
text, appendix, prep, pos = "ঋণকৃত", "কৃতঋণ", "থেকে", "বিশেষণ"
elseif (
bortype == "learned" or
bortype == "semi-learned" or
bortype == "orthographic" or
bortype == "unadapted"
) then
text, prep = bortype .. " ঋণকৃত", "থেকে"
else
error("Internal error: Unrecognized bortype: " .. bortype)
end
end
-- If the term is suppressed, the preposition should always be "from":
-- "Calque of Chinese 中國".
-- "Calque from Chinese" (not "Calque of Chinese").
if term == "-" then
prep = "থেকে"
end
appendix = "পরিশিষ্ট:শব্দকোষ#" .. (appendix or text)
if senseid then
local senseids, output = mw.text.split(senseid, '!!'), {}
for i, id in ipairs(senseids) do
-- FIXME: This should be done via a function.
insert(output, mw.getCurrentFrame():preprocess('{{senseno|' .. lang:getCode() .. '|' .. id .. (i == 1 and not nocap and "|uc=1" or "") .. '}}'))
end
local link
if senseid:find('!!') then
link, text = "are", pos == "adjective" and text or plural or pluralize(text)
else
link = pos == "adjective" and "is" or "is a"
end
text = mw.text.listToText(output) .. " " .. link .. " " .. '[[' .. appendix .. '|' .. text .. ']]'
else
text = "[[" .. appendix .. "|" .. (nocap and text or gsub(text, "^.", upper)) .. "]]"
end
return prep .. " " .. text .. " "
-- এখানে "থেকে ঋণকৃত" ধরনের আউটপুট আসবে
-- prep = থেকে এবং text = ঋণকৃত যা উপরে text, appendix, prep, pos = "ঋণকৃত", "কৃতঋণ", "থেকে", "বিশেষণ" লাইনে সংজ্ঞায়িত করা হয়েছে।
end
function export.specialized_borrowing(bortype, lang, terminfo, sort_key, nocap, notext, nocat, senseid, template_name)
local m_etymology = require("Module:etymology")
local categories, source = {}, terminfo.lang
local text = export.get_specialized_borrowing_text_insert_cats(bortype, categories, lang, terminfo.term, source, nocap, nocat, senseid)
text = notext and "" or text
return m_etymology.format_etyl(lang, source, sort_key, categories, nocat) .. m_etymology.process_and_create_link(terminfo, template_name) .. " " .. text
end
function export.specialized_multi_borrowing(bortype, lang, sc, sources, terminfo, sort_key, nocap, notext, nocat, conj, senseid, template_name)
local categories, term = {}, terminfo.term
local text
for _, source in ipairs(sources) do
text = export.get_specialized_borrowing_text_insert_cats(bortype, categories, lang, term, source, nocap, nocat, senseid)
end
text = notext and "" or text
return text .. require("Module:etymology/multi").format_sources(lang, sc, sources, terminfo, sort_key, categories, nocat, conj) ..
require("Module:etymology").process_and_create_link(terminfo, template_name)
end
return export