Help:Creating a template

From Wiktionary, the free dictionary
(Redirected from Help:Writing templates)
Jump to navigation Jump to search
This documentation is out of date.
The documentation on this page or section no longer reflects its current state, and some information may be missing or incorrect. Please help by editing the documentation page, and adding information about undocumented features, while removing information that is no longer applicable.
If you need help creating a template, please ask in the Grease pit.

Form-of templates[edit]

Examples: {{obsolete spelling of}}, {{he-noun form of}}, {{pt-obsolete-hellenism}}; main category: Form-of templates.

These are for use as, or in, definition lines, where the definition desired is simply "alternative spelling of something", "past-tense of something", or the like. If a dedicated template is not needed, one can use {{form of}} or, for conjugations or declensions, {{inflection of}}.

To create such a template, first decide on its name. If the template is specific to a certain language, it should be named with that language's code and a hyphen, e.g. {{he-noun form of}}. (Otherwise, it should not start with a language code and a hyphen.) Normally, form-of templates' names end in "of", but some languages' templates do not. (For example, the Portuguese obsolete-form templates, like {{pt-obsolete-hellenism}}, do not.)

The content of the template should be

<span class='use-with-mention'>Description of what form the word is of <span class='mention'
>{{{{{sc|Xyzy}}}|lang={{{lang|}}}|{{#if:{{isValidPageName|{{{1}}}}}|[[{{{1}}}#{{language|{{{lang|}}}|{{{1}}}]]|{{{1}}}}}}}</span
></span>

If the template is language-specific, e.g. for Albanian (sq), this should be instead:

<span class='use-with-mention'>Description of what form the word is of <span class='mention'
>{{{{{sc|Xyzy}}}|lang={{{lang|sq}}}|{{#if:{{isValidPageName|{{{1}}}}}|[[{{{1}}}#{{language|{{{lang|sq}}}|{{{1}}}]]|{{{1}}}}}}}</span
></span>

In either case, this can be adjusted to allow for various parameters, such as some which regulate capitalization of the first letter, existence of a final period (full stop), etc. It can also be adjusted for parameters specific to the template, such as gender, dialect, register, tense, etc. The above is a bare-bones template. Please announce any new form-of template in the Grease pit.

Usage-note templates[edit]

For examples, look in Category:Usage templates by language.

To create such a template, first decide on its name. It should begin with the prefix U:. If the template is specific to a certain language, it should next have that language's code; for example, the template which explains the usage of the English words less and fewer is Template:U:en:less and fewer.[1]

The content of the template should simply be the text to display as a usage note. An initial asterisk may or may not be included within the template.

New-entry boilerplate templates[edit]

Examples: {{new en plural third bot}}, {{new io-n}}; main category: Entry templates.

See Wiktionary:Entry templates.

List templates[edit]

Examples: {{list:reds/en}}, {{list:Latin script letter names/de}}; main category: List templates by language.

Userboxes[edit]

Examples: {{User fr-4}}, {{User en}}; category: Language user templates.

Users are encouraged to indicate language proficiency by the usage of Babel boxes; they may also indicate proficiency in various writing systems. Some users also indicate time zone. Other user boxes are forbidden by vote.

To create a language-proficiency box, first decide on the proficiency level: 0 (none), 1 (basic), 2 (intermediate), 3 (advanced), 4 (proficient or near-native), or N (native). the template will then be named [[template:User language code-0]] through [[template:User language code-4]] or, for native, [[template:User language code]] alone.

The content of the template is:

{{User lang-number of proficiency
|language code
|Translation into the language of "This user knows [[:category:User language-code|Language name]] at a [[:category:User language-code-level|proficiency]] level"}}

Thus, for example, {{User fr-4}}'s content is

{{User lang-4|fr|Cet utilisateur parle '''[[:Category:User fr|français]]''' à un niveau '''[[:Category:User fr-4|comparable à la langue maternelle]]'''.}}

and {{User en}}'s content is

{{User lang|en|This user is a '''[[:Category:User en-N|native]]''' speaker of '''[[:Category:User en|English]]'''.}}

Afterward, starting on the same line, include also

<noinclude>
{{documentation}}
</noinclude>

Notes[edit]