Module:Lang: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 127:
return table.concat (cat);
end
 
 
--[[--------------------------< M A K E _ T R A N S L I T >----------------------------------------------------
 
]]
 
local function make_translit (code, language_name, translit, std, script)
local title;
local tout = {};
table.insert (tout, "''<span title=\"");
if not is_set (std) and not is_set (script) then
table.insert (tout, language_name);
table.insert (tout, ' transliteration"');
else
table.insert (tout, 'standard transliteration (TODO: support standard and script"');
end
 
table.insert (tout, ' class="Unicode" style="white-space:normal; text-decoration:none">');
table.insert (tout, translit);
table.insert (tout, "</span>''");
return table.concat (tout);
end
 
 
--[=[-------------------------< L A N G >----------------------------------------------------------------------
Line 164 ⟶ 189:
--[=[-------------------------< L A N G _ X X >----------------------------------------------------------------
 
{{#invoke:lang|lang_xx|code={{{1}}}|text={{{2}}}|link={{{links|{{{link}}}}}}|rtl={{{rtl}}}|nocat={{{nocat}}}|italic={{{italic}}}|lit={{{lit}}}|translit={{{translit}}}|litscript={{{litscript}}}|std={{{std}}}}}
 
|code = the BCP47 language code
|text = the displayed text in language specified by code
|link = boolean true (default) links language specified by code to associated language article
|rtl = boolean true identifies the language specified by code as a right-to-left language
|nocat = boolean true inhibits normal categorization; error categories are not affected
|italic = boolean true (default) renders displayed text in italic font
|lit = text that is a literal translation of text
 
for those {{lang-xx}} templates that support transliteration:
|translit = text that is a transliteration of text
|std = the standard that applies to the transliteration
|script = ISO 15924 script name; falls back to code
 
]=]
Line 183 ⟶ 221:
end
local script = args.script or language_name; -- for translit prefer script of language
 
if not is_set (language_name) then
table.insert (out, '<span style="font-size:100%" class="error">error: unknown language code: ');
Line 205 ⟶ 245:
table.insert (out, make_text_span (args.code, args.text, args.rtl, args.italic, args.size))
if is_set (args.littranslit) then -- transliteration (not supported in {{lang}}); not supported in all {{lang-xx}}
table.insert (out, ', <small>');
if mw.title.makeTitle (0, 'Romanization of ' .. language_name) then
table.insert (out, make_wikilink ('Romanization of ' .. script or language_name, 'translit.'));
else
table.insert (out, '<abbr title="transliteration">translit.</abbr>');
end
table.insert (out, '&nbsp;</small>');
table.insert (out, make_translit (args.code, language_name, args.translit, args.std, args.script))
end
if is_set (args.lit) then -- translation (not supported in {{lang}})
table.insert (out, ', <small>');