Help:Creating a template

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
If you need help creating a template, please ask in the Grease pit.

Contents

Context templates [edit]

Examples: {{mathematics}}, {{chiefly}}, {{slang}}, {{transitive}}, {{Canada}}; main category: Context labels

Before creating a context template, first be sure that the template is not already being called as a context template by any pages. If the template you wish to create is called template:foo, check special:whatlinkshere/template:foo for transclusions. If it is already in use, please do not create it, or be sure that your template matches the intent of its existing uses.

Also, check whether a similar-enough context template exists already. This section is a stub.

For how to then create a context template, see Wiktionary:Context labels#Creating label templates.

Language templates [edit]

Examples: {{fr}}, {{ajw}}; category: Language code templates

If you see one of these is absent that you think should exist, please check Wiktionary:Language treatment to see whether your language is being treated, for Wiktionary's purposes, as not a language but a dialect of another language. If your language is not listed as a dialect on that page, but you suspect it may be treated as a dialect of a larger language, raise the issue in the [[Wiktionary talk:About Language name]] page for the larger language, e.g. Wiktionary talk:About French. (If that page does not exist, use the Grease pit instead.) If there is no objection to creating the template, or if you have no reason to think your language is being treated as a dialect, then create the template.

A language template should be at [[template:language code]] and consist of the the following code:

{{{l|[}}}{{{l|[}}}Language name in English{{{l|]]}}}<noinclude>
{{documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>

Dialect and language-family templates [edit]

Examples (dialects): {{etyl:hbo}}, {{etyl:fr-CA}}, {{etyl:LL.}}; category: Etymology-only language code templates
Examples (language families): {{etyl:ine}}, {{etyl:gem}}; category: Family code templates

This is only for dialects that Wiktionary does not treat as languages, and for language families; one such still may be used in etymology sections if a template is created for it.

First, for dialects, check that your dialect is not being treated as a language. Check whether it has a language code and whether that [[template:language code]] exists. Also see Wiktionary:Language treatment. Then check Category:Etymology-only language code templates to see whether your dialect already has a template.

To create a template, first find an appropriate name for it. Where possible, a dialect template should be named using an RFC 4646 language code (see "Language tags in HTML and XML" for a good introduction with many examples). A language-family template should be named per ISO 639-5 (see, e.g., wikipedia:List of ISO 639-5 codes).

The content of this template is:

{{#switch:{{{1|}}}
|disp=What should be displayed in the etymology sections (dialect/family name in English)
|pedia=Title of English Wikipedia article on the dialect/family
|cat=Name of the category into which words deriving from this dialect/family should be placed

The cat parameter is, e.g., Ancient Hebrew to yield Category:Terms derived from Ancient Hebrew.

Note that if the Wikipedia article's name is the same as the disp parameter, or if the disp parameter is the name of a redirect page on Wikipedia to the right Wikipedia article, then the pedia parameter should not be set. (This is the usual case.)

If the pedia parameter is not being set, per above, and the cat and disp parameters coincide (as they normally will), then the template's content should be simpler:

Dialect/family name in English

In any event, after the above, you should also include, starting on the same line as the above,

<noinclude>
{{documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>

Inflection-line templates [edit]

This section is a stub.

Inflection-table templates [edit]

This section is a stub.

Form-of templates [edit]

Examples: {{obsolete spelling of}}, {{is-conjugation of}}, {{lt-form-adj}}; 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 template is not needed, one can use {{form of}}, or, for conjugations or declensions, {{conjugation of}} or {{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. {{is-conjugation 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 Lithuanian templates, like {{lt-form-adj}}, 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]

Example: {{en-usage-h-an}}, {{he-begedkefet}}, {{width-usage}}; category: Usage templates

To create such a template, first decide on its name. If the template is specific to a certain language, it should preferably be named with that language's code and a hyphen, e.g. {{he-begedkefet}}. Also, ideally, it should start (after the language code if any) with "usage". In practice, neither of these guidelines is consistently practiced.

The content of the template should simply be the text to display as a usage note.

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

See template:list/doc.

Userboxes [edit]

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

All userboxes are forbidden by policy except language-proficiency boxes.

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 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>