This module combines data from the language data modules into a single table. It should only be used in Lua modules that need to look at the data for all languages, such as Wiktionary:List of languages. It should not be used in entries, because its memory footprint is huge.
See Wiktionary:Grease pit/2013/November#Module:languages.
local string = string
local table = table
local find = string.find
local format = string.format
local gsub = string.gsub
local next = next
local require = require
local all_scripts
do
local scripts, n = {}, 0
for script in next, require("Module:scripts/data") do
n = n + 1
scripts = script
end
table.sort(scripts)
all_scripts = table.concat(scripts, ",")
end
local modules = {
"Module:languages/data/2",
"Module:languages/data/exceptional"
}
local data = {}
for i = 1, 28 do
local mname = modules or format("Module:languages/data/3/%c", 0x5E + i)
for key, value in next, require(mname) do
-- Handle the special script codes "All" and "Hants".
local value4 = value
if value4 == "All" then
value = all_scripts
elseif value4 and find(value4, "Hants", 1, true) then
value = gsub(value4, "Hants", "Hani,Hant,Hans")
end
data = value
end
for lkey, lvalue in next, require(mname .. "/extra") do
local lkey_data = data
if lkey_data then
for key, value in next, lvalue do
lkey_data = value
end
end
end
end
return data