Module:Lang: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 299:
at {{Language with name and transliteration}}. If |script= is set, this function uses it in preference to code.
 
To avoid confusion, in this module and the templates that use it, the transliteration script parameter is renamed
to be |transl-script= (in this function, tscript)
]]
 
local function make_translit (code, language_name, translit, std, scripttscript)
local title;
local tout = {};
Line 308 ⟶ 310:
table.insert (tout, "''<span title=\"");
if not is_set (std) and not is_set (scripttscript) then -- when neither standard nor script specified
table.insert (tout, language_name); -- write a generic tool tip
table.insert (tout, ' transliteration');
elseif is_set (std) and is_set (scripttscript) then -- when both are specified
if title_table[std][scripttscript] then -- and legitimate
table.insert (tout, title_table[std][scripttscript]); -- add the appropriate text to the tool tip
else
return ''; -- one or both invalid, set up for an error message
end
elseif is_set (std) then -- transl-script not set, use language code
if not title_table[std] then return ''; end -- invalid standard, setupt for error message
Line 325 ⟶ 327:
table.insert (tout, title_table[std]['default']); -- so use the standard's default
end
else -- here if transl-script set but std not set
if title_table['NO_STD'][scripttscript] then
table.insert (tout, title_table['NO_STD'][scripttscript]); -- use transl-script if set
elseif title_table['NO_STD'][code] then
table.insert (tout, title_table['NO_STD'][code]); -- use language code
Line 428 ⟶ 430:
--[[--------------------------< L A N G _ X X >----------------------------------------------------------------
 
<includeonly>{{#invoke:lang|lang_xx|code=<code>|text={{{1|}}}|link={{{links|{{{link}}}}}}|rtl={{{rtl|}}}|nocat={{{nocat|}}}|italic={{{italic|}}}|lit={{{lit|}}}|translit={{{translit|}}}|transl-script={{{transl-script|}}}|std={{{std|}}}}}</includeonly>
 
|code = the BCP47 language code
Line 441 ⟶ 443:
|translit = text that is a transliteration of text
|std = the standard that applies to the transliteration
|transl-script = ISO 15924 script name; falls back to code
 
]]
Line 479 ⟶ 481:
end
 
translit_script = args.['transl-script'] or language_name; -- for translit prefer |trans-script= over language
 
if 'no' == args.link then
Line 499 ⟶ 501:
end
table.insert (out, '&nbsp;</small>');
translit = make_translit (args.code, language_name, args.translit, args.std, args.['transl-script'])
if is_set (translit) then
table.insert (out, translit);
else
return make_error_msg (table.concat ({'{{lang-xx}}: invalid translit std: \'', args.std or 'missing', '\' or script: \'', args.['transl-script'] or 'missing', '\''}), args.nocat);
end
end
Anonymous user