Module:ISO 639 name/ISO 639-2/make: Difference between revisions

Content deleted Content added
update links
 
(5 intermediate revisions by 3 users not shown)
Line 1:
require('Module:No globalsstrict');
 
--[=[------------------------< I S O _ S Y N O N Y M _ E X T R A C T >-----------------------------------------
 
{{#invoke:Language/name/data/ISO 639 synonymname/ISO extraction tool639-2/make|ISO_synonym_extract|file-date=2013-01-11}}
 
reads a local copy of data from the table at http://www.loc.gov/standards/iso639-2/php/English_list.php, extracts
Line 57:
--[[--------------------------< I S O _ 2 _ N A M E _ E X T R A C T >------------------------------------------
 
{{#invoke:Language/name/data/ISO 639 synonymname/ISO extraction tool639-2/make|ISO_2_name_extract|file-date=2013-01-11}}
 
reads a local copy of data from the table at http://www.loc.gov/standards/iso639-2/php/English_list.php, extracts
Line 83:
local name_table = {}; -- holds language names for processing
local code_table = {}; -- because some languages have both -2B and -2T codes
local out_tableout_table_T = {}; -- output table for 639-2T codes
local out_table_B = {}; -- output table for 639-2B codes
local out_table; -- used as a pointer to the selected out_table_B or out_table_T
local file_date = 'File-Date: ' .. frame.args["file-date"]; -- set the file date line from |file-date= (from the bottom of the source page)
Line 99 ⟶ 101:
code_table = mw.text.split (split_table[4], ' */ *'); -- split 'ISO 639-2' code at the '/' into a table of -2B and -2T individual codes
for _i, code in ipairs (code_table) do -- now built a table entry for the code(s) and its(their) associated language(s)
if not skip_table[code] then -- source data has duplicates so check to see if we have already done this code
out_table = (2 == #code_table and 1 == i) and out_table_B or out_table_T; -- does this language name have both -2B and -2T codes?
table.insert (out_table,
table.concat ({
Line 116 ⟶ 119:
end
table.sort (out_tableout_table_T);
table.sort (out_table_B);
-- return "<br /><pre>-- " .. file_date .. "<br />return {<br />&#9;" .. table.concat (out_tableout_table_T, ',<br />&#9;') .. "<br />&#9;}<br />" .. "</pre>";
return table.concat ({
"<br /><pre>-- ",
file_date,
"<br />return {",
string.rep ('&#9;', 18),
'-- 639-2T<br />&#9;',
table.concat (out_table_T, ',<br />&#9;'),
"<br />&#9;}<br />" .. "</pre><br /><br />",
"<br /><pre>-- ",
file_date,
"<br />return {",
string.rep ('&#9;', 18),
'-- 639-2B<br />&#9;',
table.concat (out_table_B, ',<br />&#9;'),
"<br />&#9;}<br />" .. "</pre><br /><br />",
});
end