<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ALanguage%2Fdata%2FISO_639-2%2Fmake</id>
	<title>Module:Language/data/ISO 639-2/make - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ALanguage%2Fdata%2FISO_639-2%2Fmake"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Language/data/ISO_639-2/make&amp;action=history"/>
	<updated>2026-06-14T06:39:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Language/data/ISO_639-2/make&amp;diff=472410&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Language/data/ISO_639-2/make&amp;diff=472410&amp;oldid=prev"/>
		<updated>2021-07-15T23:29:48Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require('Module:No globals');&lt;br /&gt;
&lt;br /&gt;
--[=[------------------------&amp;lt; I S O _ S Y N O N Y M _ E X T R A C T &amp;gt;-----------------------------------------&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Language/data/ISO 639-2/make|ISO_synonym_extract|file-date=2013-01-11}}&lt;br /&gt;
&lt;br /&gt;
reads a local copy of data from the table at http://www.loc.gov/standards/iso639-2/php/English_list.php, extracts&lt;br /&gt;
the ISO 639-2 (or 639-2T) codes that have equivalent ISO 639-1 codes and creates a table to translate 639-2 to 639-1.&lt;br /&gt;
ISO-639-3 uses 639-2T codes&lt;br /&gt;
&lt;br /&gt;
useful lines in the source table have the form:&lt;br /&gt;
	&amp;lt;English name&amp;gt;\t&amp;lt;all English names&amp;gt;\t&amp;lt;all French names&amp;gt;\t&amp;lt;639-2 code&amp;gt;\t&amp;lt;639-1 code&amp;gt;\n&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;English name&amp;gt; is primary English name (not used here); one of &amp;lt;all English names&amp;gt; so duplicates code listing&lt;br /&gt;
	&amp;lt;all English names&amp;gt; is all of the English names (not used here)&lt;br /&gt;
	&amp;lt;all French names&amp;gt; is all of the French names (not used here)&lt;br /&gt;
	&amp;lt;639-2 code&amp;gt; is the three-character ISO 639-2 or 639-2B/639-2T language code; when 639-2T present, use that code&lt;br /&gt;
	&amp;lt;639-1 code&amp;gt; is the two-character ISO 639-1 language code synonym of the -2 code (if one is defined)&lt;br /&gt;
		&lt;br /&gt;
	like this (with synonym):&lt;br /&gt;
		Abkhazian	Abkhazian	abkhaze	abk	ab&lt;br /&gt;
	or (without synonym):&lt;br /&gt;
		Achinese	Achinese	aceh	ace	 &lt;br /&gt;
&lt;br /&gt;
for the file date use the date listed at the bottom of the source page in yyyymmdd numeric format without hyphens or spaces&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function ISO_synonym_extract (frame)&lt;br /&gt;
	local page = mw.title.getCurrentTitle();									-- get a page object for this page&lt;br /&gt;
	local content = page:getContent();											-- get unparsed content&lt;br /&gt;
	local content_table = {};													-- table of text lines from source&lt;br /&gt;
	local split_table = {};														-- table of lines split at the tabs	&lt;br /&gt;
	local skip_table = {};														-- table of 636-2/639-2T codes that have been handled; used to prevent duplication&lt;br /&gt;
	local out_table = {};														-- output table&lt;br /&gt;
	&lt;br /&gt;
	local file_date = 'File-Date: ' .. frame.args[&amp;quot;file-date&amp;quot;];					-- set the file date line from |file-date= (from the bottom of the source page)&lt;br /&gt;
&lt;br /&gt;
	content_table = mw.text.split (content, '[\r\n]');							-- make a table of text lines&lt;br /&gt;
	for _, line in ipairs (content_table) do									-- for each line&lt;br /&gt;
		split_table = mw.text.split (line, '\t');								-- split at the table&lt;br /&gt;
		if split_table[5] and (' ' ~= split_table[5]) then						-- if there is a 639-1 code&lt;br /&gt;
			local code = split_table[4]:match ('%a+/(%a+)') or split_table[4];	-- when 639-2B/639-2T use 639-2T else use 639-2&lt;br /&gt;
			if not skip_table[code] then										-- skip if code already in the skip table because more than one language name&lt;br /&gt;
				skip_table[code] = true;										-- remember that we've handled this 636-2/639-2T code&lt;br /&gt;
				table.insert (out_table, &amp;quot;[\&amp;quot;&amp;quot; .. code .. &amp;quot;\&amp;quot;] = \&amp;quot;&amp;quot; .. split_table[5] .. &amp;quot;\&amp;quot;&amp;quot;);		-- make new table entry&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	table.sort (out_table);&lt;br /&gt;
	&lt;br /&gt;
	return &amp;quot;&amp;lt;br /&amp;gt;&amp;lt;pre&amp;gt;-- &amp;quot; .. file_date .. &amp;quot;&amp;lt;br /&amp;gt;return {&amp;lt;br /&amp;gt;&amp;amp;#9;&amp;quot; .. table.concat (out_table, ',&amp;lt;br /&amp;gt;&amp;amp;#9;') .. &amp;quot;&amp;lt;br /&amp;gt;&amp;amp;#9;}&amp;lt;br /&amp;gt;&amp;quot; .. &amp;quot;&amp;lt;/pre&amp;gt;&amp;quot;;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S O _ 2 _ N A M E _ E X T R A C T &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Language/data/ISO 639-2/make|ISO_2_name_extract|file-date=2013-01-11}}&lt;br /&gt;
&lt;br /&gt;
reads a local copy of data from the table at http://www.loc.gov/standards/iso639-2/php/English_list.php, extracts&lt;br /&gt;
the ISO 639-2 and 639-2T codes and their associated language names&lt;br /&gt;
&lt;br /&gt;
useful lines in the source table have the form:&lt;br /&gt;
	&amp;lt;English name&amp;gt;\t&amp;lt;all English names&amp;gt;\t&amp;lt;all French names&amp;gt;\t&amp;lt;639-2 code&amp;gt;\t&amp;lt;639-1 code&amp;gt;\n&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;English name&amp;gt; is primary English name (not used here); one of &amp;lt;all English names&amp;gt; so duplicates code listing&lt;br /&gt;
	&amp;lt;all English names&amp;gt; is all of the English names (used here)&lt;br /&gt;
	&amp;lt;all French names&amp;gt; is all of the French names (not used here)&lt;br /&gt;
	&amp;lt;639-2 code&amp;gt; is the three-character ISO 639-2 or 639-2B/639-2T language code; both are used&lt;br /&gt;
	&amp;lt;639-1 code&amp;gt; is the two-character ISO 639-1 language code synonym of the -2 code (not used here)&lt;br /&gt;
&lt;br /&gt;
for the file date use the date listed at the bottom of the source page in yyyymmdd numeric format without hyphens or spaces&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ISO_2_name_extract (frame)&lt;br /&gt;
	local page = mw.title.getCurrentTitle();									-- get a page object for this page&lt;br /&gt;
	local content = page:getContent();											-- get unparsed content&lt;br /&gt;
	local content_table = {};													-- table of text lines from source&lt;br /&gt;
	local split_table = {};														-- table of lines split at the tabs	&lt;br /&gt;
	local skip_table = {['qaa-qtz']=true};										-- table of 636-2/639-2T codes that have been handled; used to prevent duplication; qaa-qtz reserved for local use so not supported here&lt;br /&gt;
	local name_table = {};														-- holds language names for processing&lt;br /&gt;
	local code_table = {};														-- because some languages have both -2B and -2T codes&lt;br /&gt;
	local out_table_T = {};														-- output table for 639-2T codes&lt;br /&gt;
	local out_table_B = {};														-- output table for 639-2B codes&lt;br /&gt;
	local out_table;															-- used as a pointer to the selected out_table_B or out_table_T&lt;br /&gt;
	&lt;br /&gt;
	local file_date = 'File-Date: ' .. frame.args[&amp;quot;file-date&amp;quot;];					-- set the file date line from |file-date= (from the bottom of the source page)&lt;br /&gt;
&lt;br /&gt;
	content_table = mw.text.split (content, '[\r\n]');							-- make a table of text lines&lt;br /&gt;
	for _, line in ipairs (content_table) do									-- for each line&lt;br /&gt;
		split_table = mw.text.split (line, '\t');								-- split at the tab&lt;br /&gt;
&lt;br /&gt;
		if split_table[4] then													-- if a code then continue processing; skip this line else&lt;br /&gt;
			name_table = mw.text.split (split_table[2], ' *; *');				-- split 'all English names' at the '; ' into a table of individual names&lt;br /&gt;
			for i, v in ipairs (name_table) do&lt;br /&gt;
				name_table [i] = mw.ustring.gsub (v, '(.+)', '&amp;quot;%1&amp;quot;');			-- add double quotes around each name&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			code_table = mw.text.split (split_table[4], ' */ *');				-- split 'ISO 639-2' code at the '/' into a table of -2B and -2T individual codes&lt;br /&gt;
			&lt;br /&gt;
			for i, code in ipairs (code_table) do								-- now built a table entry for the code(s) and its(their) associated language(s)&lt;br /&gt;
				if not skip_table[code] then									-- source data has duplicates so check to see if we have already done this code&lt;br /&gt;
					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?&lt;br /&gt;
					table.insert (out_table,&lt;br /&gt;
						table.concat ({&lt;br /&gt;
							'[&amp;quot;',												-- open code index&lt;br /&gt;
							code,												-- the code&lt;br /&gt;
							'&amp;quot;] = {',											-- close code index; open name table&lt;br /&gt;
							table.concat(name_table, ', '),						-- add the names&lt;br /&gt;
							'}'													-- close the names table&lt;br /&gt;
						})&lt;br /&gt;
					)&lt;br /&gt;
					skip_table[code] = true;									-- remember that we've done this code&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	table.sort (out_table_T);&lt;br /&gt;
	table.sort (out_table_B);&lt;br /&gt;
	&lt;br /&gt;
--	return &amp;quot;&amp;lt;br /&amp;gt;&amp;lt;pre&amp;gt;-- &amp;quot; .. file_date .. &amp;quot;&amp;lt;br /&amp;gt;return {&amp;lt;br /&amp;gt;&amp;amp;#9;&amp;quot; .. table.concat (out_table_T, ',&amp;lt;br /&amp;gt;&amp;amp;#9;') .. &amp;quot;&amp;lt;br /&amp;gt;&amp;amp;#9;}&amp;lt;br /&amp;gt;&amp;quot; .. &amp;quot;&amp;lt;/pre&amp;gt;&amp;quot;;&lt;br /&gt;
	return table.concat ({&lt;br /&gt;
		&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;pre&amp;gt;-- &amp;quot;,&lt;br /&gt;
		file_date,&lt;br /&gt;
		&amp;quot;&amp;lt;br /&amp;gt;return {&amp;quot;,&lt;br /&gt;
		string.rep ('&amp;amp;#9;', 18),&lt;br /&gt;
		'-- 639-2T&amp;lt;br /&amp;gt;&amp;amp;#9;',&lt;br /&gt;
		table.concat (out_table_T, ',&amp;lt;br /&amp;gt;&amp;amp;#9;'),&lt;br /&gt;
		&amp;quot;&amp;lt;br /&amp;gt;&amp;amp;#9;}&amp;lt;br /&amp;gt;&amp;quot; .. &amp;quot;&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;quot;,&lt;br /&gt;
		&amp;quot;&amp;lt;br /&amp;gt;&amp;lt;pre&amp;gt;-- &amp;quot;,&lt;br /&gt;
		file_date,&lt;br /&gt;
		&amp;quot;&amp;lt;br /&amp;gt;return {&amp;quot;,&lt;br /&gt;
		string.rep ('&amp;amp;#9;', 18),&lt;br /&gt;
		'-- 639-2B&amp;lt;br /&amp;gt;&amp;amp;#9;',&lt;br /&gt;
		table.concat (out_table_B, ',&amp;lt;br /&amp;gt;&amp;amp;#9;'),&lt;br /&gt;
		&amp;quot;&amp;lt;br /&amp;gt;&amp;amp;#9;}&amp;lt;br /&amp;gt;&amp;quot; .. &amp;quot;&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;quot;,&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	ISO_synonym_extract = ISO_synonym_extract,&lt;br /&gt;
	ISO_2_name_extract = ISO_2_name_extract&lt;br /&gt;
	};&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>