Module:hi

Hello, you have come here looking for the meaning of the word Module:hi. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:hi, but we will also tell you about its etymology, its characteristics and you will know how to say Module:hi in singular and plural. Everything you need to know about the word Module:hi you have here. The definition of the word Module:hi will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:hi, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

General purpose Hindi module.


local export = {}

local lang = require("Module:languages").getByCode("hi")
local m_translit = require("Module:hi-translit")
local rsplit = mw.text.split
local gsub = mw.ustring.gsub
local sub = mw.ustring.sub


--From ]
function export.new(frame)
	local title = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local pos = args or ""
	local def = args or "{{rfdef|hi}}"
	local pos2 = args or (args and "" or false)
	local def2 = args or "{{rfdef|hi}}"
	local pos3 = args or (args and "" or false)
	local def3 = args or "{{rfdef|hi}}"
	local etym = args or false
	local head = args or false
	local pron = args or false
	local g = args or false
    local g2 = args or false
    local g3 = args or false
    local decl = args or false
	local conj = args or false -- conjugation stuff
    local t = args or false
    local c = args or args or false
    local ref = args or false
    local pp = args or false --perfect participle

	local result = ""
	
	local function genTitle(text)
		local pos_title = {
			 = "Noun",  = "Noun",  = "Proper noun",  = "Proper noun",  = "Pronoun",
			 = "Verb",  = "Adjective",  = "Adjective",  = "Determiner",  = "Adverb",
			 = "Preposition",  = "Postposition",  = "Postposition",  = "Conjunction",
			 = "Particle",  = "Suffix",  = "Prefix",
			 = "Proverb",  = "Idiom",  = "Phrase",  = "Interjection",  = "Interjection",
			 = "Numeral",  = "Abbreviation",  = "Conjunction",
             = "Adjective",  = "Verb",  = "Noun",
             = "Perfect participle",
		};
		return pos_title or mw.ustring.upper(sub(text, 1, 1)) .. sub(text, 2, -1)
	end
	
	local function genHead(text)
		local pos_head = {
			 = "noun",  = "noun",  = "proper noun",  = "proper noun",  = "verb",  = "adj",  = "adv",
			 = "post",  = "prep",  = "con",  = "pron",
			 = "interj",  = "perfect participle",
		};
		return pos_head or text
	end
	
	local function other(class, title, args)
		local code = ""
		if args then
			code = code .. "\n\n===" .. title .. "===\n* {{l|hi|" .. args .. "}}"
			
			if args then
				code = code .. "\n* {{l|hi|" .. args .. "}}"
				
				if args then
					code = code .. "\n* {{l|hi|" .. args .. "}}"
					
					if args then
						code = code .. "\n* {{l|hi|" .. args .. "}}"
					end
				end
			end
		end
		return code
	end
	
	-- header
	result = result .. "==Hindi=="
	
	-- Wikipedia
	if args then result = result .. "\n{{wikipedia|lang=hi}}" end
	
	-- Alternative forms
	result = result .. other("alt", "Alternative forms", args)
	
	-- Etymology
	if etym then etym = mw.ustring.gsub(etym, "^%<", "From") end
	if etym then result = result .. "\n\n===Etymology===\n" .. etym end
	
	-- Pronunciation
	if pron then
		result = result .. "\n\n===Pronunciation===\n* {{hi-IPA" .. ((pron ~= title and pron ~= "") and ("|" .. gsub(pron, ",", "|")) or "") .. "}}"
	else
		result = result .. "\n\n===Pronunciation===\n* {{hi-IPA}}"
	end
	result = result .. "\n\n===" .. genTitle(pos) .. "===\n{{hi-" .. genHead(pos) .. (head and ("|head=" .. head) or "") .. (g and ("|g=" .. g) or "") .. (t and ("|" .. t) or "") .. (pp and ("|" .. pp) or "") .. "}}\n\n# " .. def
    
    -- Morphology
    if decl and decl ~= "" then
    	if pos == "a" or pos == "adj" or pos == "det" then
    		result = result .. "\n\n====Declension====\n{{hi-adecl" .. ((decl == "1" or decl =="y" or decl == "yes") and "" or "|" .. decl) .. "}}"
    	else
    		result = result .. "\n\n====Declension====\n{{hi-ndecl|" .. decl .. "}}"
		end
	end
    if pos == "v" then
    	result = result .. "\n\n====Conjugation====\n{{hi-conj" .. (conj and "|" .. conj or "") .. "}}"
    end
	
	-- Other
	result = result .. other("syn", "=Synonyms=", args)
	result = result .. other("ant", "=Antonyms=", args)
	result = result .. other("der", "=Derived terms=", args)
	result = result .. other("also", "=See also=", args)
	
	-- Actual Entry
	if pos2 then
		result = result .. "\n\n===" .. genTitle(pos2) .. "===\n{{hi-" .. genHead(pos2) .. (head and ("|head=" .. head) or "") .. (g2 and ("|g=" .. g2) or "") .. "}}\n\n# " .. def2
	end
	
	if pos3 then
		result = result .. "\n\n===" .. genTitle(pos3) .. "===\n{{hi-" .. genHead(pos3) .. (head and ("|head=" .. head) or "")  .. (g3 and ("|g=" .. g3) or "") .. "}}\n\n# " .. def3
	end
    
    -- categories and references
    if ref and ref ~= "" then
    	result = result .. "\n\n===References===\n* {{R:hi:McGregor" .. (ref and ("|" .. ref) or "") .."}}"
    elseif ref == "" then
    	result = result .. "\n\n===References===\n* {{R:hi:McGregor}}"
    end
    
    if c then
    	result = result .. "\n\n{{topics|hi" .. ((c ~= title and c ~= "") and ("|" .. gsub(c, ",", "|")) or "") .. "}}"
    end
	
	return result
end


function export.hi_format(text)
	text = ('<span lang="hi" class="Deva">]</span>'):format(text)
	return text
end


function export.wordify(text)
	local words, translits = {}, {}
	for word in mw.text.gsplit(text, ",") do
		table.insert(words, export.hi_format(word))
		word = gsub(word, "%]%] %[%[", " ")
		table.insert(translits, m_translit.tr(word, "hi", "Deva"))
	end
	text = table.concat(words, ", ") .. "<br><span style=\"color:#888\">" ..
		table.concat(translits, ", ") .. "</span>"
	return text
end

return export