साँचा:Xyzy/doc
Usage
सम्पादन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
सम्पादन- (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.[१] 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
सम्पादन(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}}
: 字典{{Xyzy|พจนานุกรม|lang=th|face=head}}
: साँचा:Thai
Bad examples:
{{Xyzy|foo|face=bogus}}
: foo{{Xyzy|foo|lang=xx-zz}}
: foo
Languages
सम्पादनcode | language | script |
---|---|---|
ar | अरबी | Arab |
fa | फ़ारसी | fa-Arab |
ur | उर्दू | ur-Arab |
hy | आर्मीनियाई | Armn |
xcl | साँचा:xcl | Armn |
be | बेलारूसी | Cyrl |
bg | बुल्गारियाई | Cyrl |
mk | मकदूनियाई | Cyrl |
ru | रूसी | Cyrl |
uk | यूक्रेनी | Cyrl |
cu | साँचा:cu | Cyrs |
sa | संस्कृत | Deva |
hi | हिन्दी | Deva |
got | साँचा:got | Goth |
el | यूनानी | Grek |
grc | पुरानी यूनानी | polytonic |
he | इब्रानी | Hebr |
yi | यिडिश | Hebr |
arc | साँचा:arc | Hebr |
ja | जापानी | Jpan |
ko | कोरियाई | Kore |
ta | तमिल | Taml |
te | तेलुगु | Telu |
th | थाई | Thai |
Notes
सम्पादन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
सम्पादन{{t new|fr|foo}}
: साँचा:t new{{t new|th|พจนานุกรม}}
: साँचा:t new