Template talk:context
Definition from Wiktionary, a free dictionary
Contents |
[edit] Documentation
Use this template to provide contexual information for definitions, such as archaic, by analogy, chemistry, etc. In a dictionary entry, it is placed before the definition, such as:
# {{context|AU|slang}} An [[insidious]] person.
- (Australia, slang) An insidious person.
This template provides consistency. The same visual result could be achieved with simpler formatting; however, context helps to ensure that the same labels are used across the project. For instance, {{context|math}} and {{context|maths}} both produce the same result, expanding to (mathematics).
Use of context also provides automatic categorization. For instance, the example above is categorized as Australian English and Slang. Likewise, any page labeled with math or maths will be automatically placed in Mathematics if the template is used.
[edit] Use in dictionary entries
Use {{context}} on the definition line with one or more contextual labels. (Elsewhere, use {{sense}}, {{qualifier}} or {{italbrac}} instead.) Currently, up to nine parameters can be listed, as well as a lang parameter to specify language. For instance, the following will categorize gringo as Spanish slang:
# {{context|Latin America|slang|lang=es}} An [[American]].
- (Latin America, slang) An American.
If a label is recognized, it may be automatically substituted with a standard label, and the page may be automatically categorized. If a label is not recognized, the text will be shown regardless. For instance, the following code on blue moon will still work, even though there is no "by extension" template:
# {{context|by extension}} A long time.
- (by extension) A long time.
If the first label is a context template or modifier, it isn't necessary to use {{context}} explicitly:
# {{Latin America|slang|lang=es}} An [[American]].
# {{astronomy|of a star}} Relatively small in size.
Certain modifiers such as mainly or often can also be used separately from the subsequent standard contextual label, although these should generally be used sparingly. One example of correct use is at grand poobah:
# {{usually|jocular}} Someone [[important]].
- (usually jocular) Someone important.
There are also special key words, and and or, the underscore (_) to indicate a space only, and the default comma (,) understood to mean “and”. Of these or is the most useful. The result will list the separate contexts as possibilities, as within the entry in the year of our Lord:
# {{archaic|or|religious}} [[anno domini|Anno domini]].
- (archaic or religious) Anno domini.
To add a sort key to the automatically generated categories, use skey=. This will always be followed by {{PAGENAME}} so it can be just the prefix.
[edit] Finding context labels
If the correct category can be located, the standard label name should be listed before other entries in that category. For instance, in Category:Astronomy, Template:astronomy is listed at the top of the entries, indicating that {{astronomy}} and {{context|...|astronomy|...}} will automatically categorize the entry. In some cases there may be more than one template. For instance, Template:constellation and Template:star are also listed in subcategories of Category:Astronomy as special cases.
For foreign language entries beginning with a language code prefix, be sure to check the corresponding English category, as most label templates are not language-specific. {{astronomy|lang=es}}, {{constellation|lang=pt}}, {{context|star|lang=zh}} etc. all work equally well.
There is also a collection of standard context labels, an automatically generated category. The label mathematics is standard, and it's simple to check that it appears in that category. Non-standard label templates will redirect to the standard ones. For instance, Template:math and Template:maths are both redirects to Template:mathematics. Thus any of the labels math, maths, or mathematics can be used with context and will provide the same result.
[edit] Creating label templates
These examples should guide advanced users in the formation of new contextual label templates in the Template: namespace. Make sure to create the label template at the same name as the label, using lowercase unless the word is always capitalized.
Each template contains a call to context:
{{context {{{sub|}}}|label=(label)|topcat=(category)
|sub={{{sub|}}}|lang={{{lang|}}}|skey={{{skey|}}}
|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}}}
this generates a label, and places the entry in a topic category, using the language code if not English.
The label= parameter may be wikilinked, and may include an alternate.
The second and third lines are all magic, and should be exactly as given when possible, to facilitate a 'bot modification if required in future.
[edit] POS or POS like categories
If the category is a POS type category, for example the idiomatic label template, use poscat=: poscat=idioms. (note in this case it should be lower case) If a language is specified, it will generate the category with the language name. If no category is desired, both topcat and poscat may be omitted. (There isn't a known case where both are required? It will work.)
{{context {{{sub|}}}|label=(label)|poscat=(category)
|sub={{{sub|}}}|lang={{{lang|}}}|skey={{{skey|}}}
|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}}}
[edit] Regional labels
A country or regional label for a dialect or variant is written
{{context {{{sub|}}}|label=(region name)|regcat=(region adjective)|lang={{#if:{{{lang|}}}|{{{lang}}}|(xx)}}
|sub={{{sub|}}}|skey={{{skey|}}}
|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}}}
Where (region name) is the proper name of the country or region (city, area, tribal/ethnic area, etc), (region adjective) is the adjectival form (e.g. for "Mexico", this is "Mexican", and (xx) is the default language to use. (Note that the lang parameter has to be defaulted as shown, the simpler form of parameter defaulting does not work with multiple labels.)
[edit] Modifiers
A modifier is a label template that adds _ as its first parameter: ...|label=usually|_|... in Template:usually and does not use the category parameters.
[edit] Customization
Readers can customize the display of definition context qualifiers. Your current style is this:
- (context like this, your current style) a definition....
Some readers prefer custom styles:
- (context like this, non-italic) a definition....
- (context like this, mostly italic) a definition....
- (context like this, all italic) a definition....
- (context like this, non-italic) a definition....
- Context like this, small-caps and no parentheses a definition...
- (Context like this, small font) a definition
This template allows readers to choose such custom formats using WT:PREFS or by editing your personal CSS file (e.g. Special:Mypage/monobook.css), as described in WT:CUSTOM.
[edit] Comments
-
- See archived comments at Template talk:context/archive
[edit] Format suggestions for new label templates
Currently, the recommended wikitext for creating new context labels looks like this:
{{context {{{sub|}}}|label=(label)|topcat=(category)
|sub={{{sub|}}}|lang={{{lang|}}}|skey={{{skey|}}}|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}}}
I think it would actually look nicer like this:
{{context {{{sub|}}}|label=(label)|topcat=(category)
|sub={{{sub|}}}|lang={{{lang|}}}|skey={{{skey|}}}
|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}}}
The first line contains the parts that are expected to be customized for each template, the second line contains the named pass-through parameters, and the third line contains the unnamed pass-through parameters. I'd probably do the regional tags like so:
{{context {{{sub|}}}|label=(region name)|regcat=(region adjective)
|lang={{#if:{{{lang|}}}|{{{lang}}}|(xx)}}
|sub={{{sub|}}}|skey={{{skey|}}}
|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}}}
Any thoughts? Mike Dillon 02:55, 20 August 2007 (UTC)
-
-
-
- (edited Mike's comment to remove the "x" from sub|x, so it won't confuse people) Robert Ullmann 12:16, 24 October 2007 (UTC)
-
-
- It would be nice to have these as templates, such as Template:new label, which can {{subst:PAGENAME}} for the label and is passed the category as its only parameter. (Something special would have to be done to avoid any of the other parameters from being evaluated upon creation.) Similarly another template for new regional labels would take the region adjective and default language. Do we need a template for parts of speech and modifiers? Why not. DAVilla 06:44, 20 August 2007 (UTC)
-
- Started Template:new label; seems to work OK with regular substitution (interestingly subst: and subst:msgnw yield the same outcome). I'm sure it's far from perfect, but it will at least be useful for poor schmucks like me who can never remember this stuff. -- Visviva 06:34, 26 September 2007 (UTC)
- Yes something like that. I'd like to keep all of the variants on the first line (e.g. the lang default), but that isn't critical (the python code that produces User:Robert Ullmann/Context labels depends on it being on the first line, but that is a SMOC ;-) and the separate line looks good. Breaking the second line (invariants) does look better, especially because it will pretty much always have a noinclude tag on the end. A "new label" template seems more trouble than it is worth; why not just copy and paste from the examples above? Robert Ullmann 14:18, 20 August 2007 (UTC)
[edit] US vs USA vs U.S. vs U.S.A.
I have no idea how any of the wiki-markup works, but I noticed on corn that one sense of the word says US while the other says U.S.A., with the latter apparently originating here. In my experience living here, it seems that it's always U.S. or USA rather than visa-versa, but regardless, one of the templates should be changed so the spellings agree with one another. (Amusing from a lexicographical perspective, given the spelling confusion in this country, that there would be confusion over how to abbreviate the very country's name. :-D) Globish 02:25, 24 November 2007 (UTC)
- Okay, I feel silly. Maybe I was viewing a newer version of the source than the version I saw in my browser... It's been fixed either way. Sorry. Globish 02:26, 24 November 2007 (UTC)
[edit] "context:language" seems to be broken
"context:language" seems to display empty parentheses, see the 2nd sense at drow. Language Lover 06:37, 18 April 2008 (UTC)
Not entirely sure, but I think that template is used for calling up languages from SIL codes, not as context tag. You may want to leave a note with Robert Ullmann to double check this. I have changed the context tag on drow to linguistics, which seems to work. I don't know if this is the most appropriate tag for the sense; feel free to change it to something better if you can think of one. -Atelaes λάλει ἐμοί 06:49, 18 April 2008 (UTC)
- Yes, {{language}} isn't a context template. I'm working out a sneaky way to solve a number of glitches, borrowing a method from DAVilla's older version of {context} (which there was hacked pretty badly ;-). Robert Ullmann 13:57, 19 April 2008 (UTC)
-
- This should be fixed, but it may be a bit too much magic. Robert Ullmann 14:19, 19 April 2008 (UTC)
[edit] Haywireness
I don't have the competence to fix this, but the last change seems to have caused the rendering of wikified non-template arguments (e.g. {{context|[[coral]] science}} ) to go all screwy: (coral science). -- Visviva 13:31, 20 April 2008 (UTC)
- Oh dear, I thought I had gotten that case correct! Will fix. Should be okay now. Robert Ullmann 19:28, 20 April 2008 (UTC)
-
- Wonderful, thanks. -- Visviva 23:48, 20 April 2008 (UTC)
[edit] Multilingual
Should mul for lang= be ignored? --Ivan Štambuk 00:58, 6 June 2008 (UTC)
- Can you give varied examples of multilingual terms with a context so that their categorization can be examined? My guess is that excluding "en"/"English" where we would otherwise use the language to name categories makes it undesireable to categorize multilingual terms. DAVilla 07:20, 7 June 2008 (UTC)
- I can't remember exactly where, but when I posted this on some ==Translingual== entry I saw Category:mul:Something (i.e. lang=mul was used on context label), and it was not etymology related.
- You're right, entries like Aves so far don't have lang= at all so they're Translingual terms appearing in English topical categories, which doesn't seem quite all right.
- Moreover, {infl} recently enforced categorization, so for {infl|mul|PoS} in the inflection line numerous categories like Category:Translingual symbols started appearing which look anomalous (every symbol is inherently translingual, these are not symbols in some Category:Translingual language [hey - this category contains something!], but symbols independent of any language)
- My guess is the the current mismatch for translingual code mul in a number of templates, which is caused by the fact that the adjective translingual does not mean her "belonging to a specific language", is best to be handled by completely ignoring him everywhere, so that e.g. {zoology|lang=mul} should display (zoology) but not categorise. That's the approach that {etyl} uses from the beginning. --Ivan Štambuk 12:56, 7 June 2008 (UTC)
-
-
- I don't think that mul should be ignored, but rather it should be a sort of kill switch, preventing any type of categorizing. Generally, translingual entries have been categorized into their own special cats, such as Category:Taxonomic names, and basically into no other categories (so, as Ivan notes, translingual entries derived from Ancient Greek do not go into Category:Ancient Greek derivations nor Category:mul:Ancient Greek derivations, the categorization is simply not done). While this is admittedly imperfect, until a solution is presented, it seems like the best SOP. -Atelaes λάλει ἐμοί 00:45, 8 June 2008 (UTC)
-
-
-
-
- That's what I originally meant by "ignored", i.e. not-categorizing, just haven't expressed myself more clearly. I was referring to those that use lang=mul, and thought on those translingual terms terms that don't use lang=mul in context labels like an anomalous cases which should be fixed with lang=mul, which would then be covered with the above "don't categorize" scenario.
- Now if someone who actually understands the code would make the bold edit.. --Ivan Štambuk 01:00, 8 June 2008 (UTC)
-
-
-
-
-
-
- Wow. I didn't realize quite how complex a template this is. It's beyond my capabilities. -Atelaes λάλει ἐμοί 01:07, 8 June 2008 (UTC)
-
-
-

