| Modul Lua ini digunakan pada banyak halaman dan perubahannya kemungkinan memicu perubahan massal pada semua halaman yang menggunakannya. Uji cobalah di subhalaman /bak pasir atau /kasus uji Modul:High-use, atau bak pasir modul Anda. Pertimbangkan untuk mendiskusikan perubahan di halaman pembicaraan sebelum mengimplementasikannya. |
| Modul ini menggunakan Lua: |
Menerapkan {{High-use}}. Menggunakan nilai yang diperbarui bot dari subhalaman dari Module:Transclusion_count/data/ jika tersedia.
Dokumentasi di atas ditransklusikan dari Modul:High-use/doc. (sunting | riwayat)
Penyunting dapat melakukan uji coba pada halaman bak pasir (buat | cermin) dan kasus uji (buat) modul ini.
Subhalaman modul ini.
Penyunting dapat melakukan uji coba pada halaman bak pasir (buat | cermin) dan kasus uji (buat) modul ini.
Subhalaman modul ini.
localp={} localgetArgs=require('Module:Arguments').getArgs -- _fetch looks at the "demo" argument. local_fetch=require('Module:Transclusion_count')._fetch localyesno=require('Module:Yesno') functionp._num(args,count,no_percent) ifcount==nilthen ifyesno(args['fetch'])==falsethen if(args[1]or'')~=''thencount=tonumber(args[1])end else count=_fetch(args) end end -- Build output string localreturn_value="" ifcount==nilthen ifargs[1]=="risiko"then return"sangat banyak" else return"banyak" end else -- Use 2 significant figures for smaller numbers and 3 for larger ones localsigfig=2 ifcount>=100000then sigfig=3 end -- Prepare to round to appropriate number of sigfigs localf=math.floor(math.log10(count))-sigfig+1 -- Round and insert "approximately" or "+" when appropriate if(args[2]=="yes")or(type(args[1])=='string'and(mw.ustring.sub(args[1],-1)=="+"))then -- Round down return_value=string.format("%s+",mw.getContentLanguage():formatNum(math.floor((count/10^(f)))*(10^(f)))) else -- Round to nearest return_value=string.format("sekitar %s",mw.getContentLanguage():formatNum(math.floor((count/10^(f))+0.5)*(10^(f)))) end -- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes no_percent=no_percentorargs['no-percent'] ifcountandcount>250000andnotyesno(no_percent)then localnumpages=mw.getCurrentFrame():callParserFunction('NUMBEROFPAGES','R') localpercent=math.floor(((count/numpages)*100)+0.5) ifpercent>=1then return_value=string.format("%s halaman, atau sekira %s%% dari keseluruhan",return_value,percent) end end end returnreturn_value end functionp.num(frame,count) returnp._num(getArgs(frame),count) end -- Actions if there is a large (greater than or equal to 100,000) transclusion count functionp._risk(args) ifargs[1]=="risk"then return"risk" else localcount=_fetch(args) ifcountandcount>=100000then return"risk" end end return"" end functionp.risk(frame) returnp._risk(getArgs(frame)) end functionp._text(args,count) -- Only show the information about how this template gets updated if someone -- is actually editing the page and maybe trying to update the count. localbot_text=(mw.getCurrentFrame():preprocess("{{REVISIONID}}")=="")and"\n\n----\n'''Pratinjau pesan''': Jumlah transklusi diperbarui secara otomatis ([[Template:High-use/doc#Detail teknis|lihat dokumentasi]])."or'' ifcount==nilthen ifyesno(args['fetch'])==falsethen if(args[1]or'')~=''thencount=tonumber(args[1])end else count=_fetch(args) end end localtitle=mw.title.getCurrentTitle() if((args.demoor''~='')andmw.title.new(args.demo,10))then title=mw.title.new(args.demo,10) end iftitle.subpageText=="doc"ortitle.subpageText=="sandbox"then title=title.basePageTitle end localsystemMessages=(args['system']or'')~='' -- This retrieves the project URL automatically to simplify localization. localtemplateCount=('pada [https://linkcount.toolforge.org/?project=%s&page=%s#transclusions %s halaman]'):format( title:fullUrl():gsub('//(.-)/.*','%1'), mw.uri.encode(title.fullText),p._num(args,count)) localused_on_text="'''"..(title.namespace==828and"Modul Lua"or"Templat")..' ini digunakan '; ifsystemMessagesthen used_on_text=used_on_text..args['system'].. ((countandcount>2000)and("''', dan "..templateCount)or("'''")) else used_on_text=used_on_text..templateCount.."'''" end localsandbox_text=("subhalaman [[%s/bak pasir|/bak pasir]] atau [[%s/kasus uji|/kasus uji]] %s, atau [[%s]] Anda. "):format( (title.namespace==828and"module"or"template"), title.fullText,title.fullText, title.namespace==828and"Module:Sandbox|bak pasir modul"or"Wikipedia:Halaman pengguna#SUB|subhalaman pengguna" ) localinfoArg=args["info"]~=""andargs["info"] if(systemMessagesorargs[1]=="risk"or(countandcount>=100000))then localinfo=systemMessagesand'.<br/>Perubahan pada templat atau modul ini dapat mengubah antarmuka pengguna Wikipedia secara serentak.'or'.' ifinfoArgthen info=info.."<br />"..infoArg end sandbox_text=info..'<br /> Untuk mencegah suntingan mengganggu skala besar'.. (countandcount>=100000and' dan beban peladen'or'').. ', setiap perubahan harus diuji di '..sandbox_text.. 'Perubahan yang telah diuji kemudian dapat ditambahkan ke halaman ini dalam satu suntingan. ' else sandbox_text=(infoArgand('.<br />'..infoArg..' P')or' dan p').. 'erubahannya kemungkinan memicu perubahan massal pada semua halaman yang menggunakannya. Uji cobalah di '..sandbox_text end localdiscussion_text=systemMessagesand'Harap diskusikan perubahan 'or'Pertimbangkan untuk mendiskusikan perubahan ' ifargs["2"]andargs["2"]~=""andargs["2"]~="yes"then discussion_text=string.format("%sdi [[%s]]",discussion_text,args["2"]) else discussion_text=string.format("%sdi [[%s|halaman pembicaraan]]",discussion_text,title.talkPageTitle.fullText) end returnused_on_text..sandbox_text..discussion_text.." sebelum mengimplementasikannya."..bot_text end functionp.text(frame,count) returnp._text(getArgs(frame),count) end functionp._main(args,nocat) localcount=nil ifyesno(args['fetch'])==falsethen if(args[1]or'')~=''thencount=tonumber(args[1])end else count=_fetch(args) end localimage="[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]" localtype_param="style" localepilogue='' ifargs['system']andargs['system']~=''then image="[[File:Ambox important.svg|40px|alt=Warning|link=]]" type_param="content" nocat=nocatorargs['nocat'] localcategorise=(nocat==''ornotyesno(nocat)) ifcategoriseandnotmw.title.getCurrentTitle().isRedirectthen epilogue=mw.getCurrentFrame():preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}') end elseif(args[1]=="risk"or(countandcount>=100000))then image="[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]" type_param="content" end ifargs["form"]=="editnotice"then returnmw.getCurrentFrame():expandTemplate{ title='editnotice', args={ ["image"]=image, ["text"]=p._text(args,count), ["expiry"]=(args["expiry"]or"") } }..epilogue else returnrequire('Module:Message box').main('ombox',{ type=type_param, image=image, text=p._text(args,count), expiry=(args["expiry"]or"") })..epilogue end end functionp.main(frame) returnp._main(getArgs(frame)) end returnp