localp={}localgsub=mw.ustring.gsublocallength=mw.ustring.lenlocaldata=require("Module:Language/scripts/data")functionp.print(frame)localscriptCode=frame.args[1]localscriptData=scriptCodeanddata[scriptCode]or"Please supply a valid script code."localcharacters=scriptDataandscriptData.charactersor"No characters found for "..scriptCode.."."returncharactersendlocalscript={}-- Based on the Script:countCharacters() function of Module:scripts on WiktionarylocalfunctioncountCharacters(text,scriptCode)ifnotdata[scriptCode]["characters"]thenreturn0elselocal_,count=gsub(text,"["..data[scriptCode]["characters"].."]","")returncountendendfunctionp.isLatn(text)iftype(tostring(text))=="string"thenlocalcount=countCharacters(text,"Latn")ifcount<(length(text)/4)then-- Only 25% of characters in string are Latinreturnfalseelsereturntrueendelsereturnnilendendfunctionp.Latin(frame)localtext=frame.args[1]returnp.isLatn(text)endreturnp