<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pttlink.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AIn_lang</id>
	<title>Module:In lang - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pttlink.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AIn_lang"/>
	<link rel="alternate" type="text/html" href="https://wiki.pttlink.org/index.php?title=Module:In_lang&amp;action=history"/>
	<updated>2026-04-08T08:29:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://wiki.pttlink.org/index.php?title=Module:In_lang&amp;diff=5376&amp;oldid=prev</id>
		<title>Kg7qin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.pttlink.org/index.php?title=Module:In_lang&amp;diff=5376&amp;oldid=prev"/>
		<updated>2022-01-20T09:47:02Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:47, 20 January 2022&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key mediawiki:diff::1.12:old-5375:rev-5376 --&gt;
&lt;/table&gt;</summary>
		<author><name>Kg7qin</name></author>
	</entry>
	<entry>
		<id>https://wiki.pttlink.org/index.php?title=Module:In_lang&amp;diff=5375&amp;oldid=prev</id>
		<title>Mediawiki&gt;Trappist the monk at 16:14, 25 December 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.pttlink.org/index.php?title=Module:In_lang&amp;diff=5375&amp;oldid=prev"/>
		<updated>2021-12-25T16:14:34Z</updated>

		<summary type="html">&lt;p&gt;&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;
&lt;br /&gt;
--[[--------------------------&amp;lt; _ I N _ L A N G &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
implements {{in lang}}&lt;br /&gt;
&lt;br /&gt;
Module entry point from another module&lt;br /&gt;
&lt;br /&gt;
|link=yes - creates wikilinked language names&lt;br /&gt;
|template=&amp;lt;template name&amp;gt; - customizes error messages created by Module:lang&lt;br /&gt;
|list-cats=yes - documentation tool returns language-category names of cats populated by this template&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;languageicon&amp;quot;&amp;gt;(in &amp;lt;language&amp;gt;)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function _in_lang (args)&lt;br /&gt;
	local synonym_table = mw.loadData ('Module:Lang/ISO 639 synonyms');			-- ISO 639-2/639-2T code translation to 639-1 code&lt;br /&gt;
	local list_cats = 'yes' == args['list-cats'];								-- make a boolean&lt;br /&gt;
	local list = {};&lt;br /&gt;
	local cats = {};&lt;br /&gt;
	local maint_msgs = {};&lt;br /&gt;
	&lt;br /&gt;
	if not args[1] then&lt;br /&gt;
		local template = (args['template'] and table.concat ({'{{', args['template'], '}}: '})) or '';	-- make template name (if provided by the template)&lt;br /&gt;
		return table.concat ({'&amp;lt;span style=\&amp;quot;color:#d33\&amp;quot;&amp;gt;error: ', template, 'missing language tag&amp;lt;/span&amp;gt;'});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local module = 'Module:Lang' .. (mw.getCurrentFrame():getTitle():match ('/sandbox') or '');	-- if this module is the sandbox,&lt;br /&gt;
&lt;br /&gt;
	local name_from_tag = require (module)._name_from_tag;						-- use Module:Lang/sandbox; Module:Lang else&lt;br /&gt;
&lt;br /&gt;
	local namespace = mw.title.getCurrentTitle().namespace;						-- used for categorization&lt;br /&gt;
	local this_wiki_lang = mw.language.getContentLanguage().code;				-- get this wiki's language code&lt;br /&gt;
&lt;br /&gt;
	for i, lang in ipairs (args) do&lt;br /&gt;
		local code = args[i]:lower();&lt;br /&gt;
		local t = {code, ['link'] = args['link'], ['template'] = args['template']};	-- build an 'args' table&lt;br /&gt;
		lang = name_from_tag (t)												-- get the language name&lt;br /&gt;
&lt;br /&gt;
		table.insert (list, lang)												-- add this language or error message to the list&lt;br /&gt;
&lt;br /&gt;
		if not ({['ca-valencia'] = true, ['gsw-fr'] = true, ['pt-br'] = true})[code] then	-- except for these exact IETF tags; TODO: a better way/place to do this?&lt;br /&gt;
			code = code:match ('^%a%a%a?%f[^%a]');								-- strip off region, script, and variant tags so that they aren't used to make category names&lt;br /&gt;
		end&lt;br /&gt;
		if synonym_table[code] then												-- if 639-2/639-2T code has a 639-1 synonym&lt;br /&gt;
			if (0 == namespace) and not list_cats then							-- when listing cats don't include this cat; TODO: right choice?&lt;br /&gt;
				table.insert (cats, table.concat ({'[[Category:Lang and lang-xx code promoted to ISO 639-1|', code ..']]'}));&lt;br /&gt;
			end&lt;br /&gt;
			table.insert (maint_msgs, ' &amp;lt;span class=&amp;quot;lang-comment&amp;quot; style=&amp;quot;font-style:normal; display:none; color:#33aa33; margin-left:0.3em&amp;quot;&amp;gt;')&lt;br /&gt;
			table.insert (maint_msgs, table.concat ({'code: ', code, ' promoted to code: ', synonym_table[code]}));&lt;br /&gt;
			table.insert (maint_msgs, '&amp;lt;/span&amp;gt;;');&lt;br /&gt;
			code = synonym_table[code];											-- use the synonym&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if (0 == namespace) or list_cats then									-- when in article space&lt;br /&gt;
			if lang:find ('[Ee]rror') then										-- add error category (message provided by Module:Lang)&lt;br /&gt;
				if not list_cats then											-- don't include this cat when listing cats; TODO: right choice?&lt;br /&gt;
					table.insert (cats, '[[Category:in lang template errors]]');&lt;br /&gt;
				end&lt;br /&gt;
			elseif this_wiki_lang ~= code then									-- categorize article only when code is not this wiki's language code&lt;br /&gt;
				if lang:match ('%[%[.-|.-%]%]') then							-- wikilinked individual language name&lt;br /&gt;
					lang = lang:match ('%[%[.-|(.-)%]%]');&lt;br /&gt;
				elseif lang:match ('%[%[.-%]%]') then							-- wikilinked collective languages name&lt;br /&gt;
					lang = lang:match ('%[%[(.-)%]%]');&lt;br /&gt;
				end																-- neither of these then plain-text language name&lt;br /&gt;
&lt;br /&gt;
				if lang:find ('languages') then									-- add appropriate language-name category&lt;br /&gt;
					table.insert (cats, table.concat ({'[[Category:Articles with ', lang, '-collective sources (', code, ')]]'}));&lt;br /&gt;
				else&lt;br /&gt;
					table.insert (cats, table.concat ({'[[Category:Articles with ', lang, '-language sources (', code, ')]]'}));&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if list_cats then&lt;br /&gt;
		local cats = table.concat (cats, ', '):gsub ('[%[%]]', '');				-- make a string of categories and then strip wikilink markup&lt;br /&gt;
		return cats&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result = {'&amp;lt;span class=&amp;quot;languageicon&amp;quot;&amp;gt;('};							-- opening span and (&lt;br /&gt;
	table.insert (result, 'yes' == args['cap'] and 'In ' or 'in ');				-- add capitalized or uncapitalized 'in'&lt;br /&gt;
	table.insert (result, mw.text.listToText (list, ', ', (2 &amp;lt; #list) and ', and ' or ' and ' ));	-- and concatenate the language list&lt;br /&gt;
&lt;br /&gt;
	table.insert (result, ')&amp;lt;/span&amp;gt;');											-- add closing ) and closing span&lt;br /&gt;
	table.insert (result, table.concat (maint_msgs) or '');				-- add maint messages, if any&lt;br /&gt;
	table.insert (result, table.concat (cats));									-- add categories&lt;br /&gt;
	return table.concat (result);												-- make a big string and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N _ L A N G &amp;gt;----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
implements {{in lang}}&lt;br /&gt;
&lt;br /&gt;
Module entry point from an {{#invoke:lang/utilities/sanbox|in_lang|&amp;lt;code&amp;gt;|&amp;lt;code2&amp;gt;|&amp;lt;code3&amp;gt;|&amp;lt;code...&amp;gt;|link=yes|template=in lang|list-cats=yes}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function in_lang (frame)&lt;br /&gt;
	local args = require ('Module:Arguments').getArgs (frame);&lt;br /&gt;
	return _in_lang (args);&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;
	in_lang = in_lang,															-- module entry from {{#invoke:}}&lt;br /&gt;
&lt;br /&gt;
	_in_lang = _in_lang,														-- module entry from another module&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Mediawiki&gt;Trappist the monk</name></author>
	</entry>
</feed>