Module:Sandbox/trappist the monk/hyphenated language names explained

require('strict');local data_m = mw.loadData ('Module:Lang/data/iana languages');local redirect_m = require('Module:Redirect')

local function get_redirect (name) if redirect_m.luaIsRedirect (name) then local target = redirect_m.getTarget (name); -- get the redirect's target if target:find ('–', 1, true) then return table.concat ; -- make and return a wikilink end end return ; -- return empty string for concatenationend

local function list local list_t = for _, v in ipairs do -- there are two lists in the data module, do them both for tag, name_t in pairs (data_m[v]) do -- for each tag/language-name pair if name_t[1]:find ('-', 1, true) then -- look for a hyphen in the language name local redirect = ; if not (name_t[1]:find ('%d%-') or name_t[1]:find ('%-%d')) then -- skip hyphenated names where the hyphen is associated with digits if name_t[1]:find ('[Ll]anguages?') then -- for collective language names and language names that contain 'language' redirect = get_redirect (name_t[1]); table.insert (list_t, table.concat); -- make wikilink else redirect = get_redirect (name_t[1]); table.insert (list_t, table.concat); -- make nornal language wikilink end end end end end

table.sort (list_t); -- sort the list to make it all pretty-like return table.concat (list_t, '\n'); -- make a big string and doneend

return