<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Alabels%2Futilities</id>
	<title>Module:labels/utilities - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Alabels%2Futilities"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:labels/utilities&amp;action=history"/>
	<updated>2026-04-22T10:07:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:labels/utilities&amp;diff=494842&amp;oldid=prev</id>
		<title>Sware: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:labels/utilities&amp;diff=494842&amp;oldid=prev"/>
		<updated>2026-04-21T11:22:45Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:22, 21 April 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:labels/utilities&amp;diff=494841&amp;oldid=prev</id>
		<title>wikt&gt;Surjection: Changed protection settings for &quot;Module:labels/utilities&quot; ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:labels/utilities&amp;diff=494841&amp;oldid=prev"/>
		<updated>2024-11-09T20:10:02Z</updated>

		<summary type="html">&lt;p&gt;Changed protection settings for &amp;quot;&lt;a href=&quot;/wiki/Module:labels/utilities&quot; title=&quot;Module:labels/utilities&quot;&gt;Module:labels/utilities&lt;/a&gt;&amp;quot; ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local export = {}&lt;br /&gt;
&lt;br /&gt;
-- This module contains ancillary functions for manipulating labels. Currently the supported functions are for finding&lt;br /&gt;
-- the labels that generate a given category.&lt;br /&gt;
&lt;br /&gt;
local m_labels = require(&amp;quot;Module:labels&amp;quot;)&lt;br /&gt;
local languages_module = &amp;quot;Module:languages&amp;quot;&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Find the labels matching category `cat` of type `cat_type` for language `lang` (a full language object). `lang` can be&lt;br /&gt;
{nil}, but in that case no language-specific labels will be fetched. Currently supported values for `cat_type` are&lt;br /&gt;
{&amp;quot;topic&amp;quot;} for topic categories, e.g. {en:Water}; {&amp;quot;pos&amp;quot;} for POS categories, e.g. {English attenuative verbs};&lt;br /&gt;
{&amp;quot;regional&amp;quot;} for regional categories, e.g. {Ghanaian English}; {&amp;quot;sense&amp;quot;} for sense-dependent categories, e.g.&lt;br /&gt;
{English obsolete terms} or {English terms with obsolete senses} (where the particular category chosen depends on&lt;br /&gt;
whether {{tl|lb}} or {{tl|tlb}} is used); and {&amp;quot;plain&amp;quot;} for plain categories, e.g. {Issime Walser}. The format of `cat`&lt;br /&gt;
depends on `cat_type`, but in general is the portion of the category minus the language prefix or suffix. For topic&lt;br /&gt;
categories it should be e.g. {&amp;quot;water&amp;quot;} or {&amp;quot;Water&amp;quot;} (either form works); for POS categories it should be e.g.&lt;br /&gt;
{&amp;quot;attenuative verbs&amp;quot;}; for regional categories it should be e.g. {&amp;quot;Ghanaian&amp;quot;}; for sense categories it should be e.g.&lt;br /&gt;
{&amp;quot;obsolete&amp;quot;}; and for plain categories it should be e.g. {&amp;quot;Issime Walser&amp;quot;} (the actual category name).&lt;br /&gt;
&lt;br /&gt;
Note that this will only check for categories of the specified type. In particular, since the format of POS and&lt;br /&gt;
sense-dependent categories overlaps, you may need to check for labels with both types of categories. (This is done, for&lt;br /&gt;
example, in [[Module:category tree/poscatboiler]]; see that module for details.) Likewise with regional and plain&lt;br /&gt;
categories. (See the code in [[Module:category tree/poscatboiler/data/language varieties]] that handles both types of&lt;br /&gt;
categories.)&lt;br /&gt;
&lt;br /&gt;
If `cat_type` is {&amp;quot;plain&amp;quot;} and `check_all_langs` is specified, the code will check all language-specific modules for&lt;br /&gt;
plan categories matching `cat`. In that case, the relevant language is returned in the return value structure (see&lt;br /&gt;
below).&lt;br /&gt;
&lt;br /&gt;
The return value is a table whose keys are concatenations of labels and language codes (separated by a colon), and&lt;br /&gt;
whose values are objects with the following keys:&lt;br /&gt;
* `module` (the name of the module from which the label was fetched);&lt;br /&gt;
* `labdata` (the raw label data structure from this module);&lt;br /&gt;
* `canonical` (the canonical form of the label);&lt;br /&gt;
* `aliases` (a list of any aliases for the label, not including the label itself);&lt;br /&gt;
* `lang` (the language needed to generate the category using the label; this will always be the passed-in `lang` unless&lt;br /&gt;
  `check_all_langs` is specified, in which case it may be a different language).&lt;br /&gt;
&lt;br /&gt;
The table can be directly passed to `format_labels_categorizing`.&lt;br /&gt;
]==]&lt;br /&gt;
function export.find_labels_for_category(cat, cat_type, lang, check_all_langs)&lt;br /&gt;
	local function ucfirst(txt)&lt;br /&gt;
		return mw.getContentLanguage():ucfirst(txt)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local function transform_cat_for_comparison(cat)&lt;br /&gt;
		if cat_type ~= &amp;quot;pos&amp;quot; and cat_type ~= &amp;quot;sense&amp;quot; then&lt;br /&gt;
			cat = ucfirst(cat)&lt;br /&gt;
		end&lt;br /&gt;
		return cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function should_error_on_cat(cat)&lt;br /&gt;
		if cat_type == &amp;quot;topic&amp;quot; then&lt;br /&gt;
			return cat:find(&amp;quot;^[Aa]ll &amp;quot;)&lt;br /&gt;
		elseif cat_type == &amp;quot;pos&amp;quot; then&lt;br /&gt;
			return cat == &amp;quot;lemmas&amp;quot;&lt;br /&gt;
		elseif cat_type == &amp;quot;regional&amp;quot; then&lt;br /&gt;
			return cat == &amp;quot;British&amp;quot; -- an arbitrary known regional category&lt;br /&gt;
		elseif cat_type == &amp;quot;sense&amp;quot; then&lt;br /&gt;
			return cat == &amp;quot;obsolete&amp;quot; -- an arbitrary known sense category&lt;br /&gt;
		else&lt;br /&gt;
			return cat == &amp;quot;Issime Walser&amp;quot; -- an arbitrary known plain category&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function labcat_matches(labcat)&lt;br /&gt;
		if cat_type ~= &amp;quot;pos&amp;quot; and cat_type ~= &amp;quot;sense&amp;quot; then&lt;br /&gt;
			return ucfirst(labcat) == cat&lt;br /&gt;
		else&lt;br /&gt;
			return labcat == cat&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function fetch_labdata_cats(labdata)&lt;br /&gt;
		if cat_type == &amp;quot;topic&amp;quot; then&lt;br /&gt;
			return labdata.topical_categories&lt;br /&gt;
		elseif cat_type == &amp;quot;pos&amp;quot; then&lt;br /&gt;
			return labdata.pos_categories&lt;br /&gt;
		elseif cat_type == &amp;quot;regional&amp;quot; then&lt;br /&gt;
			return labdata.regional_categories&lt;br /&gt;
		elseif cat_type == &amp;quot;sense&amp;quot; then&lt;br /&gt;
			return labdata.sense_categories&lt;br /&gt;
		else&lt;br /&gt;
			return labdata.plain_categories&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	cat = transform_cat_for_comparison(cat)&lt;br /&gt;
&lt;br /&gt;
	local cat_labels_found = {}&lt;br /&gt;
	local prev_modules_labels_found = {}&lt;br /&gt;
	local this_module_labels_found&lt;br /&gt;
&lt;br /&gt;
	local function check_submodule(submodule_to_check, lang)&lt;br /&gt;
		if this_module_labels_found then&lt;br /&gt;
			for label, _ in pairs(this_module_labels_found) do&lt;br /&gt;
				prev_modules_labels_found[label] = true&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		this_module_labels_found = {}&lt;br /&gt;
		local submodule = mw.loadData(submodule_to_check)&lt;br /&gt;
		for label, labdata in pairs(submodule) do&lt;br /&gt;
			local canonical = label&lt;br /&gt;
			local num_hops = 0&lt;br /&gt;
			local hop_error = false&lt;br /&gt;
			while type(labdata) == &amp;quot;string&amp;quot; do&lt;br /&gt;
				num_hops = num_hops + 1&lt;br /&gt;
				if num_hops &amp;gt;= 10 then&lt;br /&gt;
					if should_error_on_cat(cat) then&lt;br /&gt;
						error((&amp;quot;Internal error: Likely alias loop processing label &amp;#039;%s&amp;#039; in submodule &amp;#039;%s&amp;#039;&amp;quot;):format(label, submodule_to_check))&lt;br /&gt;
					else&lt;br /&gt;
						hop_error = true&lt;br /&gt;
						break&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				-- an alias&lt;br /&gt;
				canonical = labdata&lt;br /&gt;
				labdata = submodule[labdata]&lt;br /&gt;
			end&lt;br /&gt;
			if hop_error then&lt;br /&gt;
				-- skip this label&lt;br /&gt;
			elseif not labdata then&lt;br /&gt;
				if should_error_on_cat(cat) then&lt;br /&gt;
					-- Only error at top level to avoid a flood of errors.&lt;br /&gt;
					error((&amp;quot;Internal error: In submodule &amp;#039;%s&amp;#039;, label &amp;#039;%s&amp;#039; is aliased to &amp;#039;%s&amp;#039;, which doesn&amp;#039;t exist&amp;quot;):format(submodule_to_check, label, canonical))&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				-- Deprecated labels directly assign an object to aliases, where `canonical` is the canonical label.&lt;br /&gt;
				if labdata.canonical then&lt;br /&gt;
					canonical = labdata.canonical&lt;br /&gt;
				end&lt;br /&gt;
				local labcats = fetch_labdata_cats(labdata)&lt;br /&gt;
				local matching_labcat&lt;br /&gt;
				if labcats then&lt;br /&gt;
					if type(labcats) ~= &amp;quot;table&amp;quot; then&lt;br /&gt;
						labcats = {labcats}&lt;br /&gt;
					end&lt;br /&gt;
					for _, labcat in ipairs(labcats) do&lt;br /&gt;
						if labcat == true then&lt;br /&gt;
							labcat = canonical&lt;br /&gt;
						end&lt;br /&gt;
						if labcat_matches(labcat) then&lt;br /&gt;
							matching_labcat = true&lt;br /&gt;
							break&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				local canonical_with_lang = canonical .. &amp;quot;:&amp;quot; .. (lang and lang:getCode() or &amp;quot;nil&amp;quot;)&lt;br /&gt;
				if matching_labcat and not prev_modules_labels_found[canonical_with_lang] then&lt;br /&gt;
					this_module_labels_found[canonical_with_lang] = true&lt;br /&gt;
					if not cat_labels_found[canonical_with_lang] then&lt;br /&gt;
						cat_labels_found[canonical_with_lang] = {&lt;br /&gt;
							module = submodule_to_check, canonical = canonical,&lt;br /&gt;
							aliases = {}, lang = lang, labdata = labdata&lt;br /&gt;
						}&lt;br /&gt;
					end&lt;br /&gt;
					if canonical ~= label then&lt;br /&gt;
						table.insert(cat_labels_found[canonical_with_lang].aliases, label)&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local submodules_to_check&lt;br /&gt;
	if check_all_langs then&lt;br /&gt;
		if cat_type ~= &amp;quot;plain&amp;quot; then&lt;br /&gt;
			error(&amp;quot;Currently, `check_all_langs` only supported with category type \&amp;quot;plain\&amp;quot;&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
		submodules_to_check = {}&lt;br /&gt;
		local all_lang_codes = mw.loadData(m_labels.lang_specific_data_list_module)&lt;br /&gt;
		for lang_code, _ in pairs(all_lang_codes.langs_with_lang_specific_modules) do&lt;br /&gt;
			local lang = require(languages_module).getByCode(lang_code)&lt;br /&gt;
			if lang then&lt;br /&gt;
				table.insert(submodules_to_check, {&lt;br /&gt;
					module = m_labels.lang_specific_data_modules_prefix .. lang_code,&lt;br /&gt;
					lang = lang&lt;br /&gt;
				})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		for _, submodule_to_check in ipairs(m_labels.get_submodules(nil)) do&lt;br /&gt;
			table.insert(submodules_to_check, {module = submodule_to_check, lang = lang})&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		submodules_to_check = m_labels.get_submodules(lang)&lt;br /&gt;
		for i, submodule_to_check in ipairs(submodules_to_check) do&lt;br /&gt;
			submodules_to_check[i] = {module = submodule_to_check, lang = lang}&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	for _, submodule_to_check in ipairs(submodules_to_check) do&lt;br /&gt;
		check_submodule(submodule_to_check.module, submodule_to_check.lang)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return cat_labels_found&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[==[&lt;br /&gt;
Format the labels that categorize into some category for display in the text for that category. `lang` is the&lt;br /&gt;
language of the category, or {nil}. `labels` are the labels that categorize when invoked using {{tl|lb}}, while&lt;br /&gt;
`tlb_labels` are the labels that categorize when invoked using {{tl|tlb}}. Both of these parameters are tables whose&lt;br /&gt;
keys are concatenations of labels and language codes and whose values are objects as returned by&lt;br /&gt;
`find_labels_for_category`. Returns {nil} if there are no labels.&lt;br /&gt;
]==]&lt;br /&gt;
function export.format_labels_categorizing(labels, tlb_labels, lang)&lt;br /&gt;
	local function make_code(txt)&lt;br /&gt;
		return (&amp;quot;&amp;lt;code&amp;gt;%s&amp;lt;/code&amp;gt;&amp;quot;):format(txt)&lt;br /&gt;
	end&lt;br /&gt;
	local function generate_label_set_text(labels, use_tlb, include_in_addition)&lt;br /&gt;
		local labels_by_lang = {}&lt;br /&gt;
		for _, labobj in pairs(labels) do&lt;br /&gt;
			local labobj_code = labobj.lang and labobj.lang:getCode() or false&lt;br /&gt;
			if not labels_by_lang[labobj_code] then&lt;br /&gt;
				labels_by_lang[labobj_code] = {}&lt;br /&gt;
			end&lt;br /&gt;
			table.insert(labels_by_lang[labobj_code], labobj)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local function process_lang_labels(labels)&lt;br /&gt;
			local formatted_labels = {}&lt;br /&gt;
			local has_aliases = false&lt;br /&gt;
			if labels then&lt;br /&gt;
				for _, labobj in ipairs(labels) do&lt;br /&gt;
					local function make_edit_button()&lt;br /&gt;
						return (&amp;quot;&amp;lt;sup&amp;gt;[%s edit]&amp;lt;/sup&amp;gt;&amp;quot;):format(tostring(mw.uri.fullUrl(labobj.module, &amp;quot;action=edit&amp;quot;)))&lt;br /&gt;
					end&lt;br /&gt;
					local label = labobj.canonical&lt;br /&gt;
					local aliases = labobj.aliases&lt;br /&gt;
					if #aliases == 0 then&lt;br /&gt;
						table.insert(formatted_labels, make_code(label) .. make_edit_button())&lt;br /&gt;
					elseif #aliases == 1 then&lt;br /&gt;
						table.insert(formatted_labels,&lt;br /&gt;
							(&amp;quot;%s (alias %s)%s&amp;quot;):format(make_code(label), make_code(aliases[1]), make_edit_button()))&lt;br /&gt;
						has_aliases = true&lt;br /&gt;
					else&lt;br /&gt;
						table.sort(aliases)&lt;br /&gt;
						for i, alias in ipairs(aliases) do&lt;br /&gt;
							aliases[i] = make_code(alias)&lt;br /&gt;
						end&lt;br /&gt;
						table.insert(formatted_labels,&lt;br /&gt;
							(&amp;quot;%s (aliases %s)%s&amp;quot;):format(make_code(label),table.concat(aliases, &amp;quot;, &amp;quot;), make_edit_button()))&lt;br /&gt;
						has_aliases = true&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return formatted_labels, has_aliases&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local function get_intro_text(num_labels, include_also)&lt;br /&gt;
			local intro_wording = not include_also and include_in_addition and &amp;quot;In addition, the&amp;quot; or &amp;quot;The&amp;quot;&lt;br /&gt;
			local sense_dependent = use_tlb and &amp;quot;sense-dependent &amp;quot; or &amp;quot;&amp;quot;&lt;br /&gt;
			return (&amp;quot;%s following %slabel%s %sgenerate%s this category:&amp;quot;):format(intro_wording,&lt;br /&gt;
				sense_dependent, num_labels == 1 and &amp;quot;&amp;quot; or &amp;quot;s&amp;quot;,&lt;br /&gt;
				include_also and &amp;quot;also &amp;quot; or &amp;quot;&amp;quot;, num_labels == 1 and &amp;quot;s&amp;quot; or &amp;quot;&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local function get_label_text(label_lang, formatted_labels, has_aliases)&lt;br /&gt;
			table.sort(formatted_labels)&lt;br /&gt;
			local retval = table.concat(formatted_labels, &amp;quot;; &amp;quot;) .. &amp;quot;. &amp;quot;&lt;br /&gt;
			local template = use_tlb and &amp;quot;tlb&amp;quot; or &amp;quot;lb&amp;quot;&lt;br /&gt;
			local this_label_text&lt;br /&gt;
			if #formatted_labels == 1 and not has_aliases then&lt;br /&gt;
				this_label_text = &amp;quot;this label&amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				this_label_text = &amp;quot;one of these labels&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
			if label_lang then&lt;br /&gt;
				retval = retval .. (&amp;quot;To generate this category using %s, use {{tl|%s|%s|&amp;lt;var&amp;gt;label&amp;lt;/var&amp;gt;}}.&amp;quot;):format(&lt;br /&gt;
					this_label_text, template, label_lang:getCode())&lt;br /&gt;
			else&lt;br /&gt;
				retval = retval .. (&amp;quot;To generate this category using %s, use {{tl|%s|&amp;lt;var&amp;gt;langcode&amp;lt;/var&amp;gt;|&amp;lt;var&amp;gt;label&amp;lt;/var&amp;gt;}}, &amp;quot; ..&lt;br /&gt;
					&amp;quot;where &amp;lt;code&amp;gt;&amp;lt;var&amp;gt;langcode&amp;lt;/var&amp;gt;&amp;lt;/code&amp;gt; is the appropriate language code for the language in question &amp;quot; ..&lt;br /&gt;
					&amp;quot;(see [[Wiktionary:List of languages]]).&amp;quot;):format(this_label_text, template)&lt;br /&gt;
			end&lt;br /&gt;
			return retval&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if not lang then&lt;br /&gt;
			local formatted_labels, has_aliases = process_lang_labels(labels_by_lang[false])&lt;br /&gt;
			if #formatted_labels &amp;gt; 0 then&lt;br /&gt;
				local intro_text = get_intro_text(#formatted_labels)&lt;br /&gt;
				local label_text = get_label_text(false, formatted_labels, has_aliases)&lt;br /&gt;
				return intro_text .. &amp;quot; &amp;quot; .. label_text&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			local formatted_labels, has_aliases = process_lang_labels(labels_by_lang[lang:getCode()])&lt;br /&gt;
			local this_lang_text&lt;br /&gt;
			if #formatted_labels &amp;gt; 0 then&lt;br /&gt;
				local intro_text = get_intro_text(#formatted_labels)&lt;br /&gt;
				local label_text = get_label_text(lang, formatted_labels, has_aliases)&lt;br /&gt;
				this_lang_text = intro_text .. &amp;quot; &amp;quot; .. label_text&lt;br /&gt;
			end&lt;br /&gt;
			local langcode = lang:getCode()&lt;br /&gt;
			local other_langs_label_text = {}&lt;br /&gt;
			local total_num_other_lang_labels = 0&lt;br /&gt;
			for other_lang_code, lang_labels in pairs(labels_by_lang) do&lt;br /&gt;
				if other_lang_code ~= langcode then&lt;br /&gt;
					local formatted_labels, has_aliases = process_lang_labels(lang_labels)&lt;br /&gt;
					if #formatted_labels &amp;gt; 0 then&lt;br /&gt;
						total_num_other_lang_labels = total_num_other_lang_labels + #formatted_labels&lt;br /&gt;
						local other_lang = require(languages_module).getByCode(other_lang_code, true, &amp;quot;allow etym&amp;quot;)&lt;br /&gt;
						local label_text = get_label_text(other_lang, formatted_labels, has_aliases)&lt;br /&gt;
						table.insert(other_langs_label_text,&lt;br /&gt;
							(&amp;quot;* For %s: %s&amp;quot;):format(other_lang:getCanonicalName(), label_text))&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			local other_lang_text&lt;br /&gt;
			if total_num_other_lang_labels &amp;gt; 0 then&lt;br /&gt;
				table.sort(other_langs_label_text)&lt;br /&gt;
				local intro_text = get_intro_text(total_num_other_lang_labels, this_lang_text and &amp;quot;include also&amp;quot;)&lt;br /&gt;
				other_lang_text = intro_text .. &amp;quot;\n&amp;quot; .. table.concat(other_langs_label_text, &amp;quot;\n&amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
			if this_lang_text and other_lang_text then&lt;br /&gt;
				return (&amp;quot;%s\n\n%s&amp;quot;):format(this_lang_text, other_lang_text)&lt;br /&gt;
			else&lt;br /&gt;
				return this_lang_text or other_lang_text&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local labels_text = generate_label_set_text(labels)&lt;br /&gt;
	local tlb_labels_text = tlb_labels and&lt;br /&gt;
		generate_label_set_text(tlb_labels, &amp;quot;use tlb&amp;quot;, labels_text and &amp;quot;include in addition&amp;quot;) or nil&lt;br /&gt;
	if labels_text and tlb_labels_text then&lt;br /&gt;
		return (&amp;quot;%s\n\n%s&amp;quot;):format(labels_text, tlb_labels_text)&lt;br /&gt;
	else&lt;br /&gt;
		return labels_text or tlb_labels_text&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>wikt&gt;Surjection</name></author>
	</entry>
</feed>