Module:languages/alldata: Difference between revisions
Jump to navigation
Jump to search
Chrysophylax (talk | contribs) (Created page with "local modules = { ["Module:languages/data"] = true, ["Module:languages/data2"] = true, ["Module:languages/data3/a"] = true, ["Module:languages/data3/b"] = true...") |
No edit summary |
||
Line 1: | Line 1: | ||
local modules = { | local modules = { | ||
["Module:languages/data2"] = true, | ["Module:languages/data2"] = true, | ||
["Module:languages/data3/a"] = true, | ["Module:languages/data3/a"] = true, | ||
Line 36: | Line 35: | ||
for key, value in pairs(require(mname)) do | for key, value in pairs(require(mname)) do | ||
m[key] = value | m[key] = value | ||
end | |||
local xname = mname:gsub("data", "extradata") | |||
for lkey, lvalue in pairs(require(xname)) do | |||
if m[lkey] then | |||
for key, value in pairs(lvalue) do | |||
m[lkey][key] = lvalue[key] | |||
end | |||
end | |||
end | end | ||
end | end | ||
return m | return m |
Revision as of 17:34, 8 August 2021
This module formerly contained all language data. Now it simply 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 modules = {
["Module:languages/data2"] = true,
["Module:languages/data3/a"] = true,
["Module:languages/data3/b"] = true,
["Module:languages/data3/c"] = true,
["Module:languages/data3/d"] = true,
["Module:languages/data3/e"] = true,
["Module:languages/data3/f"] = true,
["Module:languages/data3/g"] = true,
["Module:languages/data3/h"] = true,
["Module:languages/data3/i"] = true,
["Module:languages/data3/j"] = true,
["Module:languages/data3/k"] = true,
["Module:languages/data3/l"] = true,
["Module:languages/data3/m"] = true,
["Module:languages/data3/n"] = true,
["Module:languages/data3/o"] = true,
["Module:languages/data3/p"] = true,
["Module:languages/data3/q"] = true,
["Module:languages/data3/r"] = true,
["Module:languages/data3/s"] = true,
["Module:languages/data3/t"] = true,
["Module:languages/data3/u"] = true,
["Module:languages/data3/v"] = true,
["Module:languages/data3/w"] = true,
["Module:languages/data3/x"] = true,
["Module:languages/data3/y"] = true,
["Module:languages/data3/z"] = true,
["Module:languages/datax"] = true,
}
local m = {}
for mname in pairs(modules) do
for key, value in pairs(require(mname)) do
m[key] = value
end
local xname = mname:gsub("data", "extradata")
for lkey, lvalue in pairs(require(xname)) do
if m[lkey] then
for key, value in pairs(lvalue) do
m[lkey][key] = lvalue[key]
end
end
end
end
return m