মডিউল:list of languages, csv format
অবয়ব
এই মডিউলের জন্য মডিউল:list of languages, csv format/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
local languages = mw.loadData("Module:languages/alldata")
local families = mw.loadData("Module:families/data")
-- based on Module:list_of_languages
local export = {}
local filters = {}
function export.show(frame)
local args = frame.args
local filter = filters[args[1]]
local ids = args["ids"]; if not ids or ids == "" then ids = false else ids = true end
local rows = {}
-- Get a list of all language codes
local codes = {}
for code, _ in pairs(languages) do
table.insert(codes, code)
end
-- Sort the list
table.sort(codes)
local sep = ";"
local minor_sep = ","
-- Now go over each code, and create table rows for those that are selected
local output = ""
local count = 0;
local column_names = "line" ..sep.. "code" ..sep.. "canonical name" ..sep..
"category" ..sep.. "type" ..sep.. "family code" ..sep..
"family" ..sep.. "sortkey?" ..sep.. "autodetect?" ..sep..
"exceptional?" ..sep.. "script codes" ..sep.. "other names"
for i, code in ipairs(codes) do
local data = languages[code]
count = count + 1
if count < 100000 then
local row =
"" .. count .. sep ..
code .. sep .. -- code
data.canonicalName .. sep .. -- canonical name
data.canonicalName .. (data.canonicalName:find("[Ll]anguage$") and "" or " language") .. sep .. -- language category name
data.type .. sep .. -- type
data.family .. sep .. -- family code
(families[data.family].canonicalName or "") .. sep ..
(data.sort_key and "sortkey" or "") .. sep ..
(data.entry_name and "autodetect" or "") .. sep ..
(code:find("-") ~= nil and "exceptional" or "") .. sep
if data.scripts[1] ~= "None" then
row = row .. data.scripts[1]
i = 2
while data.scripts[i] do
row = row .. minor_sep .. data.scripts[i]
i = i + 1
end
end
row = row .. sep
if data.otherNames then
row = row .. data.otherNames[1]
i = 2
while data.otherNames[i] do
row = row .. minor_sep .. data.otherNames[i]
i = i + 1
end
end
--row = row .. "\n"
table.insert(rows, row)
--output = output .. "\n" .. row
end
end
-- return "<pre>\n" .. output .. "</pre>"
-- return table.concat(rows, "\n") ..
return "<pre>\n" .. column_names .. "\n" .. table.concat(rows, "\n") .. "</pre>"
end
return export