local function iso_639_name_to_code
local args = getArgs;
local result, _ = _iso_639_name_to_code (args); -- suppress true/false return used by iso_639_name_exists
return result;
end  
--[[--------------------------< I S O _ 6 3 9 _ N A M E _ E X I S T S >----------------------------------------  
template entry point; returns ISO 639-1, -2, -3, or -5 code associated with language name according to part (1, 2, 3, 5) argument;
when part is not provided scans 1, 2, 3 , 5 and returns first code  
override data are examined first  
args[1] is language name
args[2] is ISO 639 part  
local function iso_639_name_exists
local args = getArgs;
local _, result = _iso_639_name_to_code (args); -- suppress code return used by iso_639_name_to_code
return result and true or nil;
end  
--[[--------------------------< I S O _ 6 3 9 >----------------------------------------------------------------  
template entry point.
returns:
language name if args[1] is valid language code
language code if args[1] is valid language name  
this function is constrained to the ISO 639 part specified in args[2] which must be 1, 2, 2B, 3, or 5. When not provided
all parts are tested. The first match is found  
local function iso_639
local args = getArgs ;
local hide = 'yes' == args['hide-err']; -- suppress error messages and error categorization
local nocat = 'no' == args.cat; -- suppress error categorization (primarily for demo use)
local result;
local found; -- set to true when language name is found  
if not args[1] then
return error_msg ('code_name', '', hide, nocat);
end  
local part = args[2];
if part then -- if ISO 639 part supplied
local part_idx = get_part_index (part); -- map index from <part>; anything else nil  
if not part_idx then
return error_msg ('not_part', part, hide, nocat); -- abandon; args[2] is not a valid ISO 639 part
end  
result, found = iso_639_code_to_name_common (args, parts[part_idx][1], parts[part_idx][2]); -- attempt to find a code match
if found then
return result; -- found the code so return the language name
end  
result = _iso_639_name_to_code (args); -- might be a language name; return code if it is; error message or empty string else
return result; -- this way to suppress second return  
else
for _, part in ipairs (parts) do -- for each of the iso 639 parts
result, found = iso_639_code_to_name_common (args, part[1], part[2]); -- attempt to find a code match
if found then
return result; -- found the code so return the language name
end
end
end  
result = _iso_639_name_to_code (args); -- might be a language name; return code if it is; error message or empty string else
return result; -- this way to suppress second return
end  
----------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------  
return {
iso_639 = iso_639, -- returns code when given name; returns name when given code  
iso_639_code_exists = iso_639_code_exists,
iso_639_name_exists = iso_639_name_exists,  
iso_639_code_to_name = iso_639_code_to_name,
iso_639_code_1_to_name = iso_639_code_1_to_name,
iso_639_code_2_to_name = iso_639_code_2_to_name,
iso_639_code_2B_to_name = iso_639_code_2B_to_name,
iso_639_code_3_to_name = iso_639_code_3_to_name,
iso_639_code_5_to_name = iso_639_code_5_to_name,  
iso_639_name_to_code = iso_639_name_to_code,
};