Welcome to the TTSCpedia (beta)! This wiki is the successor to the FANDOM/Wikia version! You may create an account on the new wiki during the Public Beta stage and begin editing. Please see the to-do list here. Any content from the FANDOM/Wikia wiki will not be transferred automatically, such as pages, and accounts. That must be done manually by the end user, being you. |
Limited Feature Set Many TTSCpedia features are currently semi-broken due to regressions introduced with the MediaWiki upgrade. We hope to be fully operational again soon. The MonoBook skin has temporarily been set as the default skin due to Cali not being fully ported to the new version of MediaWiki. |
Changes
From The TTSCpedia
Jump to navigationJump to search
m
Javascript snippet no longer needed (and may be also inaccurate as it returns the list from the javascripts loaded by the client, possibly outdated when read from its browser cache)
local p = {};
--
--[[ Check this list by running this in the console of the Lua Module editor in MediaWiki:
="p.list={'" .. table.concat(p.getSortedList(mw.language.fetchLanguageNames()), "','") .. "',}"
]]
function p.getSortedList(mwLangList)
local sortedList = {}
for lang, _ in pairs(mwLangList) do
table.insert(sortedList, lang)
end
table.sort(sortedList)
return sortedList
end
p.list = p.getSortedList(mw.language.fetchLanguageNames())
setmetatable(p, {
quickTests = function()
local i = 0
for k, v in pairs(p.list) do
if type(k) ~= 'number' or k < 1 or k ~= math.floor(k)
or type(v) ~= 'string' or #v < 2 or #v > 16
or (v):find('^[a-z][%-0-9a-z]*[0-9a-z]$') ~= 1 then
return false, ': invalid sequence of language codes in p.list["' .. tostring(k) .. '"] = "' .. tostring(v) .. '"'
end
i = i + 1
end
if #(p.list) ~= i then return false, ': invalid sequence: length = '.. #(p.list) ' for ' .. i .. 'distinct keys' end
return true
end
})
--[[ To test this module in the Lua console:
=getmetatable(p).quickTests() -- must return true
--]]
return p;
--
--[[ Check this list by running this in the console of the Lua Module editor in MediaWiki:
="p.list={'" .. table.concat(p.getSortedList(mw.language.fetchLanguageNames()), "','") .. "',}"
]]
function p.getSortedList(mwLangList)
local sortedList = {}
for lang, _ in pairs(mwLangList) do
table.insert(sortedList, lang)
end
table.sort(sortedList)
return sortedList
end
p.list = p.getSortedList(mw.language.fetchLanguageNames())
setmetatable(p, {
quickTests = function()
local i = 0
for k, v in pairs(p.list) do
if type(k) ~= 'number' or k < 1 or k ~= math.floor(k)
or type(v) ~= 'string' or #v < 2 or #v > 16
or (v):find('^[a-z][%-0-9a-z]*[0-9a-z]$') ~= 1 then
return false, ': invalid sequence of language codes in p.list["' .. tostring(k) .. '"] = "' .. tostring(v) .. '"'
end
i = i + 1
end
if #(p.list) ~= i then return false, ': invalid sequence: length = '.. #(p.list) ' for ' .. i .. 'distinct keys' end
return true
end
})
--[[ To test this module in the Lua console:
=getmetatable(p).quickTests() -- must return true
--]]
return p;