Module:Language/data/ISO 639-1/make
< Module:Language | data | ISO 639-1
Jump to navigation
Jump to search
Used to create Module:Language/data/ISO 639-1. By default gets it data from Module:Language/data/iana languages, but can be changed by setting parameter 1 to the desired input. The module only adds table values with a key that has two letters in it.
External links[edit source]
- Module:Language/data/ISO 639-1/make at Wikipedia, the free Terran-based encyclopedia that anyone can edit.
getArgs = require('Module:Arguments').getArgs
function extract (frame)
local export = {}
local args = getArgs(frame)
local data = args[1] or 'Module:Language/data/iana languages'
local data = mw.loadData(data)
for k,v in pairs(data) do
if k == mw.ustring.match(k,'%a%a') then
local temp = '["'..k..'"] = {'
for key,value in pairs(v) do
temp = temp..'"'..value..'", '
end
temp = temp..'},<br />'
temp = mw.ustring.gsub(temp,', }','}')
table.insert(export,temp)
end
end
table.sort(export)
return 'return {<br />'..table.concat(export)..'}'
end
return {extract = extract}