Modul:ziman: Cudahiya di navbera guhartoyan de

Content deleted Content added
BKurteya guhartinê tine
Kurteya guhartinê tine
Etîket: Betalkirî
Rêz 347:
end
 
--[==[Given some text, this function iterates through the scripts of a given language and tries to find the script that best matches the text. It returns a {{code|lua|Script}} object representing the script. If no match is found at all, it returns the {{code|lua|None}} script object.]==]
function Language:findBestScript(text, forceDetect)
if (not text) or text == "" or text == "-" then
return require("Module:scripts").getByCode("None", nil, nil, useRequire)
end
if table.concat(self:getScriptCodes()) == "All" then
return require("Module:scripts").findBestScriptWithoutLang(text)
end
local scripts = self:getScripts()
if not scripts[2] and not forceDetect then
-- Necessary, because Hani covers the entire Han range (while the Hant & Hans lists don't list shared characters).
if scripts[1]:getCode():match("^Han") and require("Module:scripts").getByCode("Hani", nil, nil, useRequire):countCharacters(text) > 0 then
return scripts[1]
elseif scripts[1]:countCharacters(text) > 0 then
return scripts[1]
else
return require("Module:scripts").getByCode("None", nil, nil, useRequire)
end
end
return require("Module:languages/findBestScript")(export, self, text, scripts, forceDetect, useRequire)
end
 
function Language:toJSON()