Module:ISO 639 name

require('Module:No globals');

local getArgs = require ('Module:Arguments').getArgs; local part1_data = mw.loadData ('Module:Language/data/iana languages');			-- used only for ISO 639-1 language codes / names local part2_data = mw.loadData ('Module:Sandbox/trappist the monk/ISO 639 name/ISO 639-2');		-- ISO 639-2 language codes / names; to be moved to Module:Language/data/ISO 639-2 local part3_data = mw.loadData ('Module:Language/data/ISO 639-3');				-- existing data module

local function iso_639_name (frame) local args = getArgs(frame); local code = args[1]:lower; if 2 > #code or 3 < #code then												-- 639 codes are 2 or three characters only return 'error: ' .. code .. ' is not an ISO 639 code'; end if 2 == #code then return part1_data[code][1] or 'error: ' .. code .. ' is not an ISO 639 code'; else return part2_data[code] and part2_data[code][1] or part3_data[code] and part3_data[code][1] or 'error: ' .. code .. ' is not an ISO 639 code'; end end

----< E X P O R T E D  F U N C T I O N S >--

return {iso_639_name = iso_639_name};