Jump to content

ទំព័រគំរូ:head/doc

ពីWiktionary

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 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}}, {{cmn-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).

The basic usage is:

{{head|(lang)|(part of speech)}}

The first parameter is the language code (see Wiktionary:Languages), which is required in all cases. The second is the part of speech. For example on van:

{{head|nl|preposition}}
Lua error in Module:headword at line 90: bad argument #1 to 'inNamespace' (unrecognized namespace name 'Appendix').

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. The part of speech can be left out entirely; no category will be added then. This is discouraged, however, as it is generally assumed that the headword-line template will add a part-of-speech category in most entries.

Script code

[កែប្រែ]

The optional parameter sc= gives the script code (see Wiktionary: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|noun|sc=Cyrl|g=n}}
Lua error in Module:headword at line 328: attempt to call field 'format_genders' (a nil value).

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:

{{head|en|verb|head=[[give]] [[up]]}}
Lua error in Module:headword at line 90: bad argument #1 to 'inNamespace' (unrecognized namespace name 'Appendix').

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 Wiktionary:About Russian) for more information.

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|noun|plural|Sandboxes|irregular plural|Sandboxen}}
Lua error in Module:headword at line 90: bad argument #1 to 'inNamespace' (unrecognized namespace name 'Appendix').

The term (second part of a pair) may be blank. This can be used to add a simple note, such as "uncountable" or "intransitive". On the page 政治 (politics):

{{head|ja|noun|uncountable||hiragana|せいじ|romaji|seiji}}
政治 (uncountable, hiragana せいじ, romaji seiji)

and

{{head|cmn|noun|traditional and simplified||Pinyin|zhèngzhì}}
政治 (traditional and simplified, Pinyin zhèngzhì)

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:

{{head|ca|noun|g=m|plural|homes|or|hòmens}}
Lua error in Module:headword at line 328: attempt to call field 'format_genders' (a nil value).

An inflection term can contain wikilinks as part of the parameter, like the head= parameter as well as the {{l}} template. In this case, too, language sections will be added to the links:

{{head|en|adjective|comparative|[[more]] broken|superlative|[[most]] broken}}
Lua error in Module:headword at line 90: bad argument #1 to 'inNamespace' (unrecognized namespace name 'Appendix').

Naturally, you should not use this to specify multiple alternative forms, only to display a single form consisting of multiple words, or a term with an alternative display form.

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 (the sort_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 should chiefly be used when there is no language specific template. With 7000+ languages to be included in the English Wiktionary, most will never have specific templates.

  • Simple forms like {{head|en}} or {{head|it|noun|g=f}} work as expected.
  • When a template is created for a language, it is an easy task for a bot to replace head with the language-specific template.
    For example, it is trivial to replace {{head|en|noun|plural|foo}} with {{en-noun|pl=foo}}, a more sophisticated bot will recognize the regular forms.
  • A bot doesn't have to try to parse the language and POS headings.
  • This template makes it much simpler for a bot to generate entries for the inflected form if desired. It has the language code and the POS to use.
  • It uses the existing categories as available. If new POS categories are added, they will be used. (modulo some job-queue magic and such)
  • It automatically wikilinks its parameters if not already.