Module:Lang: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 167:
end
script = script:lower(); -- ensure that we use and return lower case version of this
 
if is_set (script) then
if not lang_name_table.script[script:lower()] then
return code, nil, nil, nil; -- language code ok, invalid script, don't know about the others (don't care?)
end
Line 433 ⟶ 435:
 
|code = (required) the BCP47 language code
|script = BCP47 script name; especially for use with languages that use multiple writing systems; yields to the script subtag in |code= if present [not currentlyyet implemented]
|text = (required) 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; when |italic= not set and |script= set to something other than Latn then args.italic='no' [not yet implemented]
|lit = text that is a literal translation of text
 
Line 445 ⟶ 447:
|std = the standard that applies to the transliteration
|transl-script = ISO 15924 script name; falls back to code
 
use of |script=
default state of |italic= for {{lang-xx}} is 'yes' - this presumes that Latn is the script for |text=
 
]]
Line 450 ⟶ 457:
function p.lang_xx (frame)
local args = getArgs(frame);
if not is_set (args.italic) then
args.italic = 'yes'; -- DEFAULT for {{lang-xx}} templates is to italicize
end
args.size = nil; -- size not supported in {{lang-xx}}
Line 474 ⟶ 477:
end
 
if not is_set (script) then -- if no ietf script subtag in args.code
if is_set (args.script) and lang_name_table.script[script:lower()] then -- and if |script= has a value and that value is legitimate script subtag
script = args.script; -- then use |script=
end
end
 
if not is_set (args.italic) then -- args.italic controls
if not is_set (script) or ('latn' == script) then -- script not set then default; script set to latn same
args.italic = 'yes'; -- DEFAULT for {{lang-xx}} templates is to italicize
else
args.italic = 'no'; -- italic not set; script not latn
end
end
args.code = format_ietf_tag (code, script, region, variant); -- format to recommended subtag styles
 
Anonymous user