Module:Lang: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
(synch from sandbox;)
Line 235: Line 235:
elseif source:match ('^%a%a%a?%-%a%a%-[%a%d][%a%d][%a%d][%a%d][%a%d]+$') then -- ll-RR-variant (where variant is 5-8 alnum characters)
elseif source:match ('^%a%a%a?%-%a%a%-[%a%d][%a%d][%a%d][%a%d][%a%d]+$') then -- ll-RR-variant (where variant is 5-8 alnum characters)
code, region, variant = source:match ('^(%a%a%a?)%-(%a%a)%-([%a%d][%a%d][%a%d][%a%d][%a%d][%a%d]?[%a%d]?[%a%d]?)$');
code, region, variant = source:match ('^(%a%a%a?)%-(%a%a)%-([%a%d][%a%d][%a%d][%a%d][%a%d][%a%d]?[%a%d]?[%a%d]?)$');
elseif source:match ('^%a%a%a?%-%d%d%d%-[%a%d][%a%d][%a%d][%a%d][%a%d]+$') then -- ll-DDD-variant (where region is 3 digits; variant is 4 digits)
elseif source:match ('^%a%a%a?%-%d%d%d%-[%a%d][%a%d][%a%d][%a%d][%a%d]+$') then -- ll-DDD-variant (where region is 3 digits; variant is 5-8 alnum characters)
code, region, variant = source:match ('^(%a%a%a?)%-(%d%d%d)%-([%a%d][%a%d][%a%d][%a%d][%a%d][%a%d]?[%a%d]?[%a%d]?)$');
code, region, variant = source:match ('^(%a%a%a?)%-(%d%d%d)%-([%a%d][%a%d][%a%d][%a%d][%a%d][%a%d]?[%a%d]?[%a%d]?)$');


Line 541: Line 541:
table.insert (tout, "<span title=\""); -- when no language code: no lang= attribute, not italic ({{transl}} only)
table.insert (tout, "<span title=\""); -- when no language code: no lang= attribute, not italic ({{transl}} only)
end
end
std = std and std:lower(); -- lower case for table indexing
if not is_set (std) and not is_set (tscript) then -- when neither standard nor script specified
if not is_set (std) and not is_set (tscript) then -- when neither standard nor script specified
table.insert (tout, language_name); -- write a generic tool tip
table.insert (tout, language_name); -- write a generic tool tip
if not language_name:find ('languages') then -- collective language names (plural 'languages' is part of the name)
table.insert (tout, '-language transliteration');
table.insert (tout, '-language') -- skip this text (individual and macro languages only)
end
table.insert (tout, ' transliteration'); -- finish the tool tip
elseif is_set (std) and is_set (tscript) then -- when both are specified
elseif is_set (std) and is_set (tscript) then -- when both are specified
if title_table[std] then -- and if standard is legitimate
if title_table[std] then -- and if standard is legitimate
Line 565: Line 570:
end
end
else -- here if translit-script set but translit-std not set
else -- here if translit-script set but translit-std not set
if title_table['NO_STD'][tscript] then
if title_table['no_std'][tscript] then
table.insert (tout, title_table['NO_STD'][tscript]); -- use translit-script if set
table.insert (tout, title_table['no_std'][tscript]); -- use translit-script if set
elseif title_table['NO_STD'][code] then
elseif title_table['no_std'][code] then
table.insert (tout, title_table['NO_STD'][code]); -- use language code
table.insert (tout, title_table['no_std'][code]); -- use language code
else
else
if is_set (tscript) then
if is_set (tscript) then
table.insert (tout, table.concat ({language_name, '-script transliteration'})); -- write a script tool tip
table.insert (tout, table.concat ({language_name, '-script transliteration'})); -- write a script tool tip
elseif is_set (code) then
elseif is_set (code) then
table.insert (tout, table.concat ({language_name, '-language transliteration'})); -- write a language tool tip
if not language_name:find ('languages') then -- collective language names (plural 'languages' is part of the name)
table.insert (tout, '-language') -- skip this text (individual and macro languages only)
end
table.insert (tout, ' transliteration'); -- finish the tool tip
else
else
table.insert (tout, ' transliteration'); -- generic tool tip (can we ever get here?)
table.insert (tout, ' transliteration'); -- generic tool tip (can we ever get here?)