Template:Head: Difference between revisions
Djpwikiadmin (talk | contribs) mNo edit summary |
Djpwikiadmin (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
{{#invoke:headword/templates|head_t}}<!-- | {{#invoke:headword/templates|head_t}}<!-- | ||
--><noinclude> {{documentation}}</noinclude> | --><noinclude>{{documentation}}</noinclude> |
Revision as of 21:39, 16 April 2019
head
- The following documentation is located at Template:Head/documentation. [edit]
- Useful links: subpage list • transclusions • redirects • sandbox
This template is used to create a basic headword line. This is the line of text that comes between the part-of-speech header (like ===Noun===
) and the actual definitions of the word. This template uses Module:headword/templates as its back-end.
Note that most invocations of {{head}}
should be fairly simple. If a language requires a relatively complex call to {{head}}
for many words (such as the same set of inflected forms in many entries, or using sort= in every entry), the language should probably have its own templates. Templates made specifically for a given language can be more sophisticated, and can handle inflections and other grammatical issues that are specific to that language. They can also make use of the capabilities of Lua modules. For this reason, keep in mind that the usage examples given on this page are for illustrative purposes only. Most of the languages given in the examples here already have their own set of templates, such as {{en-verb}}
, {{ja-noun}}
, {{zh-noun}}
, {{la-verb}}
and so on.
However, {{head}}
can be used for words for which the basic usage (two or three parameters) is enough, or for languages that do not yet have their own templates. If you know how to make your own templates, it's recommended that you create some for the language you intend to work in before creating new entries, rather than using this template (and then having to replace it with a language-specific template later).
Parameters
A short reference of all parameters.
|1=
- The language code. See Project:Languages.
|sc=
- The script code. See Project:Scripts. This is rarely needed as the script can generally be automatically detected.
|cat sc=
- The same as
|sc=
, but this also adds "in (name) script" to the category specified by the second parameter below. This is used to subcategorise words in different scripts, if languages can be written in more than one script. If both|sc=
and|cat sc=
are provided, the latter takes precedence. |2=
- The part of speech category (such as "noun", "verb", "adjective" etc), which is used to add the entry to the appropriate category. This can be in either plural or singular form. In the latter case, the template will pluralise it automatically if it doesn't already end in -s. Exceptions can be added to the
invariable
list at the top of Module:headword/templates if necessary. |cat2=
,|cat3=
- Additional part-of-speech categories. Unlike the previous, these should always be in plural.
|sort=
- The sort key to use when placing the entry in the above categories. This is rarely needed, as the default generated sort key is usually correct.
|head=
and|head2=
,|head3=
...- Overrides the headword that is displayed. This is used primarily to add diacritical marks or to link to individual words in a multi-word term. By default, if the page name has spaces in it, the words are split across the spaces, which is usually correct but may need overriding. Additional parameters are available if more than one headword needs to be shown.
|tr=
and|tr2=
,|tr3=
...- Provides the transliteration for the term, see Project:Transliteration. For many languages, this can be generated automatically so this does not need to be specified, but some entries cannot be reliably transliterated automatically (e.g. Arabic) so this parameter is necessary then. The additional parameters with a number correspond to each additional headword, pairwise.
|g=
and|g2=
,|g3=
...- Provides gender specifications for the word, if necessary. See Module:gender and number for the format used.
|3=
,|4=
and further- Specifies inflected forms to show. These are specified pairwise, with the first giving the name of the form, and the second giving the form itself. So the forms are numbered like this:
{{head|language|category|name 1|form 1|name 2|form 2|name 3|form 3|...}}
. If multiple forms exist for the same name, separate them by using "or
" as the name. Forms work the same as the 2nd parameter of{{l}}
, and can thus have embedded wikilinks, will have certain diacritics removed, and so on. - The following additional parameters are available for each form, with
N
replaced by the number of the form:|fNalt=
- Specifies the alternative display form of the inflected form, much like the 3rd parameter of
{{l}}
. |fNtr=
- Specifies the transliteration of the inflected form, much like the
|tr=
parameter of{{l}}
. |fNsc=
- Specifies the script of the form, works like
|sc=
. |fNid=
- Specifies the sense ID to use for the link to the form's entry.
|fNg=
- Specifies the gender to display after the form. Works like
|g=
. |fNqual=
- Specifies a qualifier that should appear before the form, formatted like the template
{{qualifier}}
does. This is used to mark certain forms as archaic, rare or similar.
- The following parameters are available only for each name, meaning that if multiple forms are displayed for the same name (with "
or
"), these parameters should use the number of the first form. They are automatically applied to all forms following that name.|fNaccel-form=
- Specifies an accelerated creation tag for Project:ACCEL. This should not be used directly in entries. If you find you need to use it, you should probably make a custom template for the language instead. If the acceleration tag contains a vertical bar
|
, use{{!}}
instead. |fNnolink=1
- Inhibits automatic creation of a link to the forms. The forms will just be displayed in bold text instead. Links that are embedded into the form parameters are retained.
Usage
The basic usage is:
{{head|(lang)|(part of speech)}}
The first parameter is the language code (see Project:Languages), which is required in all cases. The second is the part of speech. For example on van:
{{head|nl|prepositions}}
- van
The part of speech is used to add a category to the page. So, the above code would also add the page to Category:Dutch prepositions.
Script code
The optional parameter |sc=
gives the script code (see Project:Scripts). The script can usually be detected automatically based on the possibilities listed for the language in Module:languages, so this parameter is only needed in rare cases. The example below is thus only for illustrative purposes; a real example would not need |sc=
here.
An example, for the entry море, one might use:
{{head|sh|nouns|sc=Cyrl|g=n}}
- море n
Displayed headword
Normally, the displayed headword is the same as the name of the current page. The parameter |head=
can be used to specify a different headword to display. This can be useful if additional accent marks should be placed on the word, that are not present in the normal written form that is given in the page's name. For example, the Latin word scribo is normally written that way, but is also spelled scrībō in its fully accented form. For such a case, you would specify |head=scrībō
.
Another purpose of this parameter is for terms that consist of multiple words. The |head=
parameter can be used to link to the individual words that the term is made up of. For example, for the English phrasal verb give up, you could use:
Note in the above example that the template automatically adds the correct language section to the links in the same way as {{l}}
. So the links actually come out as if written [[give#English|give]] [[up#English|up]]
. This means that you should not add such section links yourself, nor should you use {{l}}
inside the |head=
parameter. These were necessary in the past, but they can now be safely removed.
In a few cases it may be necessary to show more than one headword. For example, a language like Russian might have a word with a single written form, but multiple alternative ways of placing the accent marks (compare this to English kílometer and kilómeter). Additional headwords can be displayed using the parameters |head2=
, |head3=
and so on.
Transliteration
If a term is written in a script other than the Latin alphabet, a transliteration of the term into the Latin alphabet should be provided using the |tr=
parameter. Every language generally has its own rules for writing transliterations on Wiktionary; check with the language's "About" page (such as Project:About Russian) for more information.
The template can automatically transliterate words in many languages; this is controlled through special transliteration modules such as Module:el-translit (and also the data in Module:languages). This means that for those languages, a transliteration does not need to be provided, as it can be generated internally. If the |head=
parameter was provided, it is used as the base for the transliteration instead, so that any additional accents are also included in the transliteration. Use |tr=-
if you don't want a transliteration to be automatically generated (you shouldn't really ever do this in an entry).
Gender and number
The template has a set of parameters to display gender, number, noun class or other kinds of grammatical property. These are used and displayed in the standard format required by Module:gender and number.
The gender is given with the optional |g=
parameter. If more than one specification is necessary, you can also use |g2=
, |g3=
and so on. If you know that a gender is needed, but don't know what it is, specify |g=?
, which will add the page to a cleanup category. You can also specify a partial gender. For example, if you know that a word is plural but don't know if it's, say, masculine or feminine plural, you can specify |g=?-p
.
Inflections
Further optional parameters are available to display inflections or other closely related forms of the word. These are given pair-wise: the first of each pair gives a label for the inflection, and the second then gives the actual term.
For example, in the Sandbox:
{{head|en|nouns|plural|Sandboxes|irregular plural|Sandboxen}}
- Sandbox (plural Sandboxes, irregular plural Sandboxen)
Certain diacritics are automatically removed from the term when creating the link, just like {{l}}
and {{term}}
do. So you don't need to worry about removing them yourself. A Latin example, where macrons are removed automatically:
{{head|la|nouns|g=m|genitive|nīdī}}
- nīdus m (genitive nīdī)
If you want to display multiple alternative forms of an inflection, you can use or
as the label separating them. The template will recognise this and omit the comma:
The term (second part of a pair) may be blank. This can be used to add a simple note, such as "uncountable" or "intransitive":
{{head|en|nouns|countable and uncountable||plural|milks}}
- milk (countable and uncountable, plural milks)
If the label is blank, but the term is not, it acts as if the term was not specified either and omits both. This is not very useful in entries, but it can be a very powerful feature when writing templates using {{head}}
as a base.
You can specify alternative display form, script, sense id and gender for each form with the parameters |fNalt=
, |fNsc=
, |fNid=
and |fNg=
, with "N" replaced with the number of the form. Some examples:
{{head|sh|nouns|head=tȇlo|g=n|Cyrillic spelling|те̑ло|f1sc=Cyrl}}
- tȇlo n (Cyrillic spelling те̑ло)
{{head|de|nouns|g=m|genitive|Hundes|or|Hunds|plural|Hunde|diminutive|Hündchen|f4g=n}}
- Hund m (genitive Hundes or Hunds, plural Hunde, diminutive Hündchen n)
{{head|ja|nouns|uncountable||hiragana|せいじ|romaji|seiji|f3sc=Latn}}
- 政治 (uncountable, hiragana せいじ, romaji seiji)
When using {{head}}
as a base to create other templates, the class for accelerated links (Project:ACCEL) can be added with |fNaccel-form=
. See Module:headword for more information on how to use this. If the label is or
, the corresponding acceleration is ignored, and it is "inherited" from the preceding form. Examples:
An inflection term can contain wikilinks as part of the parameter, like the |head=
parameter as well as the {{l}}
template. Language sections will be added to the individual links:
{{head|en|adjectives|comparative|{{wt|more}} broken|superlative|{{wt|most}} broken}}
- broken (comparative more broken, superlative most broken)
Naturally, you should only use this to display a single form that consists of multiple words. You should not use this to specify multiple alternative forms; use the or
label for this instead.
Categories
There are a few more parameters available for categories:
|sort=
specifies a category sort key. This is rarely needed, as by default, a sort key will be generated for the language according to the rules defined for that language in Module:languages (thesort_key
setting). For languages that have no sort key rules defined yet, the default sort key is the name of the page, with any hyphens removed from the beginning of the name.|cat2=
and|cat3=
specify additional category names that the page should be added to. The language's name is added in front, so if you use{{head|en|verb|cat2=irregular verbs}}
, the page will be added to both Category:English verbs and Category:English irregular verbs. Note that this parameter must be given in plural, unlike the part-of-speech parameter!
This template is used to create a basic headword line. This is the line of text that comes between the part-of-speech header (like <code>===Noun===</code>) and the actual definitions of the word.
Parameter | Description | Type | Status | |
---|---|---|---|---|
language code | 1 | The language code. See [[Project:Languages]]. | Line | required |
part of speech | 2 | The part of speech category which is used to add the entry to the appropriate category. This can be in either plural or singular form. In the latter case, the template will pluralise it automatically if it doesn't already end in ''-s''. Exceptions can be added to the <code>invariable</code> list at the top of [[Module:headword/templates]] if necessary.
| String | optional |
script code | sc | The script code. See [[Project:Scripts]]. This is rarely needed as the script can generally be automatically detected. | Unknown | optional |
script code with category | cat sc | The same as {{para|sc}}, but this also adds "in (name) script" to the category specified by the second parameter below. This is used to subcategorise words in different scripts, if languages can be written in more than one script. If both {{para|sc}} and {{para|cat sc}} are provided, the latter takes precedence. | String | optional |
part of speech category 2 | cat2 | Additional part-of-speech categories. Unlike the <code>part of speech</code>, these should always be in plural. | String | optional |
part of speech category 3 | cat3 | Additional part-of-speech categories. Unlike the <code>part of speech</code>, these should always be in plural. | String | optional |
sort key | sort | The sort key to use when placing the entry in the above categories. This is rarely needed, as the default generated sort key is usually correct. | String | optional |
head | head | Overrides the headword that is displayed. This is used primarily to add diacritical marks or to link to individual words in a multi-word term. By default, if the page name has spaces in it, the words are split across the spaces, which is usually correct but may need overriding. Additional parameters are available if more than one headword needs to be shown. | String | optional |
head2 | head2 | Additional term for the headword display. | String | optional |
head3 | head3 | Additional term for the headword display. | String | optional |
head4 | head4 | Additional term for the headword display. | String | optional |
head5 | head5 | Additional term for the headword display. | String | optional |
tr | tr | Provides the transiteration for the term, see [[Project:Transliteration]]. For many languages, this can be generated automatically so this does not need to be specified, but some entries cannot be reliably transliterated automatically (e.g. Arabic) so this parameter is necessary then. | String | optional |
tr2 | tr2 | Provides the transiteration for the term, should match <code>head2</code>. | String | optional |
tr3 | tr3 | Provides the transiteration for the term, should match <code>head3</code>. | String | optional |
tr4 | tr4 | Provides the transiteration for the term, should match <code>head4</code>. | String | optional |
tr5 | tr5 | Provides the transiteration for the term, should match <code>head5</code>. | String | optional |
g | g | Provides gender specifications for the word, if necessary. See [[Module:gender and number]] for the format used. | String | optional |
g2 | g2 | Provides gender specifications for the word, if necessary, should match <code>head2</code>. | String | optional |
g3 | g3 | Provides gender specifications for the word, if necessary, should match <code>head3</code>. | String | optional |
g4 | g4 | Provides gender specifications for the word, if necessary, should match <code>head4</code>. | String | optional |
g5 | g5 | Provides gender specifications for the word, if necessary, should match <code>head5</code>. | String | optional |
name of form 1 | 3 | The name of a first of form of a term. | String | optional |
form 1 | 4 | A first form of the term. | String | optional |