Module:scripts: Verskil tussen weergawes
Content deleted Content added
Nuwe bladsy geskep met 'local export = {} local Script = {} function Script:getCode() return self._code end function Script:getCanonicalName() return self._rawData.canonicalName end functio...' |
Werk by vanaf en: |
||
Lyn 44:
local name = self._rawData.canonicalName
-- If the name already has
-- No names contain "script".
if
return name
else
Line 133 ⟶ 134:
if not text or not lang or not lang.getScripts then
return export.getByCode("None")
end▼
local scripts = lang:getScripts()▼
return scripts[1]▼
end
Line 140 ⟶ 147:
hence Latin was returned as the script if "Latn" is one of the language's scripts.
]=]
text =
▲ local scripts = lang:getScripts()
▲ if #scripts == 1 then
▲ return scripts[1]
▲ end
-- Try to match every script against the text,
Line 154 ⟶ 155:
-- Get length of text minus any spacing or punctuation characters.
-- Counting instances of UTF-8 character pattern is faster than mw.ustring.len.
local _, length =
if length == 0 then
|