Jump to content

ماڈیول:Wikidata2/monolingualtext

وکیپیڈیا توں

Documentation for this module may be created at ماڈیول:Wikidata2/monolingualtext/doc

local p = {}

function p._main( datavalue, datatype, options )
	fetchName = require('ماڈیول:لغات').getname
	local language = mw.language.fetchLanguageName(datavalue.value.language, 'skr')
	local fa = fetchName(datavalue.value.language,'',0,'i')
	if not fa or fa =='' 
	then language2 =language
	else language2 =fa
	end
	if not fa or fa =='' then laa= language2 else laa='' end
		if options.langpref and options.langpref ~= '' then
			if options.langpref =='justlang'
				then return  language
			else
				langpref = options.langpref
				if datavalue.value.language == langpref
					then
						text  =  datavalue.value.text
						valu  = mw.text.tag('span', {title = language}, text)
						lange = '('.. language..')'
						if options.showlang and options.showlang ~= '' then 
							return mw.getCurrentFrame():preprocess('{{رمز لغة واسمها|'..
				 										datavalue.value.language ..'|'.. language2 .. '|'.. text ..'|na='.. laa .. '}}') -- valu  ..' '..lange
						else 
							return mw.getCurrentFrame():preprocess('{{رمز لغة|'..datavalue.value.language ..'|'.. text ..'}}') --valu
						end
			end
			end
		else 
			lange = '('.. language..')'
			text  =  datavalue.value.text
			valu = mw.text.tag('span', {title = language},  text)
			if options.showlang and options.showlang ~= '' then
				return mw.getCurrentFrame():preprocess('{{رمز لغة واسمها|'..
				 										datavalue.value.language ..'|'.. language2 .. '|'.. text ..'|na='.. laa .. '}}') -- valu  ..' '..lange
			else
				return mw.getCurrentFrame():preprocess('{{رمز لغة|'..datavalue.value.language ..'|'.. text ..'}}') --valu
			end
		end
end
function p.main( Frame )
	return p._main( {language=frame.args['language'], text=frame.args['text'], }, frame.args['datatype'], frame.args )
end
return p