Templet:Xyzy/helpim
Usage
[senisim]Default script template
This is used when a script template is not provided to templates such as {{term}} and {{t}}. It will generate correct attributes and html/xml language tags. If the language is in a set of known languages for which scripts can reasonably be assumed (e.g. "he" language to "Hebr" script) it invokes the specific script template.
This is only to be used by other templates, never in entries; entries should use the correct script template directly if needed.
Parameters
[senisim]- (1) text to be tagged
- lang= language code
- face= one of [term, ital, head, bold] to set default attributes
- xlang= not used as required for all script templates, so caller can avoid "lang=" when blank
The template attempts to handle various combinations of face and lang being specified or not and/or being blank.
- if lang is blank, the template adds no tagging
- if lang is missing, it adds tagging for face, if given
- if lang is not known, it adds tagging for face, if given
There are failure cases, which calling templates should take care to avoid where possible:
- if lang is missing, and face is invalid, it will generate blank lang tags (believed to be legal, but not desirable)
- Not exactly. In XHTML 1.0 Transitional (which we use), lang="" and xml:lang="" are both invalid, in that they violate the DTD (these attributes are of type NMTOKEN, which the XML 1.0 spec defines as (NameChar)+). However, XML 1.0 does define semantics for xml:lang="", saying basically that it explicitly overrides the xml:lang of an enclosing element, but without providing a new value.[1] Those semantics actually apply pretty well for us: the enclosing context is in English, but the quoted word is likely not to be. The question is, are the semantics even relevant, given that it's not valid? —RuakhTALK 18:52, 11 July 2009 (UTC)
- lang and face are partially mixed together, so things like {{Xyzy|foo|lang=term}} and {{Xyzy|foo|face=he}} have interesting effects (in this case, <>foo</> and {{|1=foo|face=he|lang={{{lang}}}}}, respectively)
- if lang is invalid, it will generate bad lang tags (not checked)
Examples
[senisim](see page source in your browser)
{{Xyzy|foo}}
: foo{{Xyzy|foo|face=bold}}
: foo{{Xyzy|foo|face=ital}}
: foo{{Xyzy|foo|face=term}}
: foo{{Xyzy|字典|lang=cmn}}
: 字典{{Xyzy|字典|lang=ja}}
: Templet:Jpan{{Xyzy|พจนานุกรม|lang=th|face=head}}
: Templet:Thai
Bad examples:
{{Xyzy|foo|face=bogus}}
: foo{{Xyzy|foo|lang=xx-zz}}
: foo
Languages
[senisim]code | language | script |
---|---|---|
ar | Templet:ar | Arab |
fa | Templet:fa | fa-Arab |
ur | Templet:ur | ur-Arab |
hy | Templet:hy | Armn |
xcl | Templet:xcl | Armn |
be | Templet:be | Cyrl |
bg | Templet:bg | Cyrl |
mk | Templet:mk | Cyrl |
ru | Templet:ru | Cyrl |
uk | Templet:uk | Cyrl |
cu | Templet:cu | Cyrs |
sa | Templet:sa | Deva |
hi | Templet:hi | Deva |
got | Templet:got | Goth |
el | Templet:el | Grek |
grc | Templet:grc | polytonic |
he | Templet:he | Hebr |
yi | Templet:yi | Hebr |
arc | Templet:arc | Hebr |
ja | Tok Siapan | Jpan |
ko | Templet:ko | Kore |
ta | Templet:ta | Taml |
te | Templet:te | Telu |
th | Templet:th | Thai |
Notes
[senisim]The name comes from the magic word "xyzzy" from Adventure. It is made to look like an ISO script name, but one very unlikely to be assigned.
It may be very tempting to add languages and scripts, but it should be avoided! Each one adds overhead to many calls on a large majority of the wikt pages, and the benefits for languages beyond what is already there are minimal. Any such change must be very carefully considered.
Tests
[senisim]{{t new|fr|foo}}
: Templet:t new{{t new|th|พจนานุกรม}}
: Templet:t new