tags for block content[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-583)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-584)The lang= attribute also applies to the content of the tag where it is placed so this is wrong because 'Spanish[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-585)language text' is English:[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-586)
[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-587)should be:[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-588)
[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-589)or for
...
[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-591)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-592)]][](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-593)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-594)local function make_text_html (code, text, tag, rtl, style, size, language)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-595)local html_t = {};[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-596)local style_added = '';[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-597)local wrapper_tag = tag;--
gets modified so save a copy for use when/if we create a wrapper span or div[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-598)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-599)if text:match ('^%*') then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-600)table.insert (html_t, '*');-- move proto language text prefix outside of italic markup if any; use numeric entity because plain splat confuses MediaWiki[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-601)text = text:gsub ('^%*', '');-- remove the splat from the text[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-602)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-603)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-604)if 'span' == tag then-- default HTML tag for inline content[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-605)if 'italic' == style then-- but if italic[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-606)tag = 'i';-- change to tags[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-607)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-608)else-- must be div so go[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-609)text = div_markup_add (text, style);-- handle implied , implied
with , and list markup (*;:#) with [](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-610)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-611)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-612)table.insert (html_t, table.concat ({'<', tag}));-- open the , , or HTML tag[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-613)code = code:gsub ('%-x%-.*', '');-- strip private use subtag from code tag because meaningless outside of Wikipedia[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-614)table.insert (html_t, table.concat ({' lang="', code, '\"'}));-- add language attribute[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-615)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-616)if (rtl or unicode.is_rtl(text)) and ('ltr' == this_wiki_lang_dir) then-- text is right-to-left on a left-to-right wiki[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-617)table.insert (html_t, ' dir="rtl"');-- add direction attribute for right-to-left languages[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-618)elseif not (rtl or unicode.is_rtl(text)) and ('rtl' == this_wiki_lang_dir) then-- text is left-to-right on a right-to-left wiki[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-619)table.insert (html_t, ' dir="ltr"');-- add direction attribute for left-to-right languages[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-620)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-621)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-622)if 'normal' == style then-- when |italic=no[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-623)table.insert (html_t, ' style=\"font-style: normal;');-- override external markup, if any[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-624)style_added = '\"';-- remember that style attribute added and is not yet closed[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-625)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-626)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-627)if is_set (size) then-- when |size=
[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-628)if is_set (style_added) then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-629)table.insert (html_t, table.concat ({' font-size: ', size, ';'}));-- add when style attribute already inserted[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-630)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-631)table.insert (html_t, table.concat ({' style=\"font-size: ', size, ';'}));-- create style attribute[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-632)style_added = '\"';-- remember that style attribute added and is not yet closed[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-633)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-634)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-635)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-636)table.insert (html_t, table.concat ({style_added, '>'}));-- close the opening HTML tag[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-637)table.insert (html_t, text);-- insert the text[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-638)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-639)table.insert (html_t, table.concat ({'', tag, '>'}));-- close the 'text' , , or HTML tag[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-640)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-641)if is_set (language) then-- create a string for the title= attribute in a wrapper span or div[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-642)local title_text;[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-643)if 'zxx' == code then-- special case for this tag 'no linguistic content'[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-644)title_text = substitute ('$1 $2', {language, cfg.make_text_html_t.zxx});-- not a language so don't use 'language' in title text[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-645)elseif mw.ustring.find (language, 'languages', 1, true) then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-646)title_text = substitute ('$1 $2', {language, cfg.make_text_html_t.collective});-- for collective languages[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-647)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-648)title_text = substitute ('$1-$2', {language, cfg.make_text_html_t.individual});-- for individual languages[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-649)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-650)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-651)return title_wrapper_make (title_text, table.concat (html_t), wrapper_tag);[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-652)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-653)return table.concat (html_t);[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-654)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-655)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-656)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-657)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-658)--[=[-------------------------< M A K E _ C A T E G O R Y >----------------------------------------------------[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-659)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-660)For individual language, , returns:[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-661) [[Category:Articles containing -language text]][](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-662)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-663)For English:[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-664)[[[Category:Articles containing explicitly cited English-language text]]](https://freemwiki.com/wiki/Category:Articles_containing_explicitly_cited_English-language_text "Category:Articles containing explicitly cited English-language text")[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-665)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-666)For ISO 639-2 collective languages (and for 639-1 bh):[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-667) [[Category:Articles with text in languages]][](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-668)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-669)]=][](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-670)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-671)local function make_category (code, language_name, nocat, name_get)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-672)if ((0 ~= namespace) or nocat) and not name_get then-- only categorize in article space[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-673)return '';-- return empty string for concatenation[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-674)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-675)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-676)if mw.ustring.find (language_name, 'languages', 1, true) then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-677)return substitute ('[[$1 $2]]', {cfg.make_category_t.collective_cat, language_name});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-678)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-679)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-680)if this_wiki_lang_tag == code then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-681)return substitute ('[[$1 $2 $3-$4]]', {-- unique category name for the local language[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-682)cfg.make_category_t.cat_prefix,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-683)cfg.make_category_t.explicit_cat,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-684)language_name,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-685)cfg.make_category_t.cat_postfix,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-686)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-687)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-688)return substitute ('[[$1 $2-$3]]', {-- category for individual languages[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-689)cfg.make_category_t.cat_prefix,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-690)language_name,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-691)cfg.make_category_t.cat_postfix,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-692)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-693)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-694)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-695)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-696)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-697)--[[--------------------------< M A K E _ T R A N S L I T >----------------------------------------------------[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-698)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-699)Return translit ... where xx is the language code; else return empty string.[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-700)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-701)The value |script= is not used in {{[transliteration](https://freemwiki.com/wiki/Template:Transliteration "Template:Transliteration")}} for this purpose; instead it uses |code. Because language scripts[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-702)are listed in the {{[transliteration](https://freemwiki.com/wiki/Template:Transliteration "Template:Transliteration")}} switches they are included in the data tables. The script parameter is introduced[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-703)at {{[Language with name and transliteration](https://freemwiki.com/wiki/Template:Language_with_name_and_transliteration "Template:Language with name and transliteration")}}. If |script= is set, this function uses it in preference to code.[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-704)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-705)To avoid confusion, in this module and the templates that use it, the transliteration script parameter is renamed[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-706)to be |translit-script= (in this function, tscript).[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-707)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-708)This function is used by both lang_xx() and xlit()[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-709) lang_xx() always provides code, language_name, and translit; may provide tscript; never provides style[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-710) xlit() always provides language_name, translit, and one of code or tscript, never both; always provides style[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-711)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-712)For {{[transliteration](https://freemwiki.com/wiki/Template:Transliteration "Template:Transliteration")}}, style only applies when a language code is provided.[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-713)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-714)]][](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-715)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-716)local function make_translit (code, language_name, translit, std, tscript, style, engvar)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-717)local title_t = lang_data.translit_title_table;-- table of transliteration standards and the language codes and scripts that apply to those standards[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-718)local title_text = '';-- tool tip text for title= attribute[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-719)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-720)std = std and std:lower();-- lower case for table indexing[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-721)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-722)if not is_set (std) and not is_set (tscript) then-- when neither standard nor script specified[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-723)title_text = language_name;-- write a generic tool tip[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-724)if not mw.ustring.find (language_name, 'languages', 1, true) then-- collective language names (plural 'languages' is part of the name)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-725)title_text = substitute ('$1-$2', {title_text, cfg.misc_text_t.language});-- skip this text (individual and macro languages only)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-726)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-727)title_text = substitute ('$1 $2', {title_text, mw.ustring.lower (cfg.engvar_t[engvar]['romanisz_lc'])});-- finish the tool tip; use romanization when neither script nor standard supplied[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-728)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-729)elseif is_set (std) and is_set (tscript) then-- when both are specified[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-730)if title_t[std] then-- and if standard is legitimate[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-731)if title_t[std][tscript] then-- and if script for that standard is legitimate[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-732)if script_table[tscript] then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-733)title_text = substitute ('$1$2 ($3 $4) $5', {-- add the appropriate text to the tool tip[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-734)title_text,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-735)title_t[std][tscript:lower()],[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-736)script_table[tscript],[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-737)cfg.make_translit_t.script,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-738)cfg.make_translit_t.transliteration,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-739)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-740)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-741)title_text = title_text .. title_t[std]['default'];-- use the default if script not in std table; TODO: maint cat? error message because script not found for this standard?[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-742)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-743)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-744)title_text = title_text .. title_t[std]['default'];-- use the default if script not in std table; TODO: maint cat? error message because script not found for this standard?[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-745)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-746)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-747)return '';-- invalid standard, setup for error message[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-748)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-749)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-750)elseif is_set (std) then-- translit-script not set, use language code[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-751)if not title_t[std] then return ''; end-- invalid standard, setup for error message[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-752)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-753)if title_t[std][code] then-- if language code is in the table (xlit may not provide a language code)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-754)title_text = substitute ('$1$2 ($3 $4) $5', {-- add the appropriate text to the tool tip[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-755)title_text,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-756)title_t[std][code:lower()],[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-757)language_name,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-758)cfg.misc_text_t.language,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-759)cfg.make_translit_t.transliteration,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-760)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-761)else-- code doesn't match[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-762)title_text = title_text .. title_t[std]['default'];-- so use the standard's default[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-763)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-764)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-765)else-- here if translit-script set but translit-std not set[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-766)if title_t['no_std'][tscript] then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-767)title_text = title_text .. title_t['no_std'][tscript];-- use translit-script if set[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-768)elseif title_t['no_std'][code] then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-769)title_text = title_text .. title_t['no_std'][code];-- use language code[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-770)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-771)if is_set (tscript) then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-772)title_text = substitute ('$1$2-$3 $4', {-- write a script tool tip[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-773)title_text,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-774)language_name,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-775)cfg.make_translit_t.script,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-776)cfg.make_translit_t.transliteration,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-777)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-778)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-779)elseif is_set (code) then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-780)if not mw.ustring.find (language_name, 'languages', 1, true) then-- collective language names (plural 'languages' is part of the name)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-781)title_text = substitute ('$1-$2', {-- skip this text (individual and macro languages only)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-782)title_text,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-783)cfg.misc_text_t.language,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-784)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-785)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-786)title_text = substitute ('$1 $2', {-- finish the tool tip[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-787)title_text,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-788)cfg.make_translit_t.transliteration,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-789)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-790)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-791)title_text = substitute ('$1 $2', {-- generic tool tip (can we ever get here?)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-792)title_text,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-793)cfg.make_translit_t.transliteration,[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-794)});[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-795)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-796)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-797)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-798)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-799)local tag[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-800)if is_set (code) then-- when a language code is provided (always with {{[lang-??](https://freemwiki.com/wiki/Template:Lang-%3F%3F "Template:Lang-??")}} templates, not always with {{[transliteration](https://freemwiki.com/wiki/Template:Transliteration "Template:Transliteration")}})[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-801)code = code:match ('^(%a%a%a?)');-- strip all subtags leaving only the language subtag[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-802)if not style then-- nil for the default italic style[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-803)tag = '%s'[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-804)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-805)tag = '%s'-- non-standard style, construct a span tag for it[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-806)tag = string.format(tag, style, "%s", "%s")[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-807)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-808)tag = string.format(tag, code, "%s")[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-809)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-810)tag = '%s'-- when no language code: no lang= attribute, not italic ({{[transliteration](https://freemwiki.com/wiki/Template:Transliteration "Template:Transliteration")}} only)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-811)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-812)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-813)tag = string.format(tag, translit)-- add the translit text[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-814)if '' == title_text then-- when there is no need for a tool-tip[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-815)return tag;-- done[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-816)else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-817)title_text = cfg.engvar_sel_t.gb == engvar and title_text:gsub ('([Rr]omani)z', '%1s') or title_text;-- gb eng when engvar specifies gb eng; us eng else[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-818)return title_wrapper_make (title_text, tag, 'span');-- wrap with a tool-tip span and done[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-819)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-820)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-821)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-822)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-823)--[[--------------------------< V A L I D A T E _ T E X T >----------------------------------------------------[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-824)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-825)This function checks the content of args.text and returns empty string if nothing is amiss else it returns an[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-826)error message. The tests are for empty or missing text and for improper or disallowed use of apostrophe markup.[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-827)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-828)Italic rendering is controlled by the |italic= template parameter so italic markup should never appear in args.text[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-829)either as ''itself'' or as '''''bold italic''''' unless |italic=unset or |italic=invert.[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-830)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-831)]][](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-832)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-833)local function validate_text (template, args)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-834)if not is_set (args.text) then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-835)return make_error_msg (cfg.validate_text_t.no_text, args, template);[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-836)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-837)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-838)if args.text:find ("%f[\']\'\'\'\'%f[^\']") or args.text:find ("\'\'\'\'\'[\']+") then-- because we're looking, look for 4 appostrophes or 6+ appostrophes[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-839)return make_error_msg (cfg.validate_text_t.malformed_markup, args, template);[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-840)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-841)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-842)local style = args.italic;[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-843)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-844)if (cfg.keywords_t.unset ~= style) and (cfg.keywords_t.invert ~=style) then[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-845)if args.text:find ("%f[\']\'\'%f[^\']") or args.text:find ("%f[\']\'\'\'\'\'%f[^\']") then-- italic but not bold, or bold italic[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-846)return make_error_msg (cfg.validate_text_t.italic_markup, args, template);[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-847)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-848)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-849)end[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-850)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-851)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-852)--[[--------------------------< R E N D E R _ M A I N T >------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-853)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-854)Render mainenance messages and categories.[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-855)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-856)]][](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-857)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-858)local function render_maint (nocat)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-859)local maint = {};[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-860)[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-861)if 0 < #maint_msgs then-- when there are maintenance messages[](https://freemwiki.com/index.php?oldid=579704&title=Module%3ALang#L-862)table.insert (maint, table.concat ({'