Template:Native name/doc

From Zoophilia Wiki
Revision as of 21:06, 12 September 2014 by meta>Sardanaphalus (→‎Annotated code: missing spaces)
Jump to navigationJump to search

An inline formatting template, based on {{lang}} and {{ISO 639 name}}, for indicating the language in which a native name has been given. By default, the native name is displayed in italics, followed by the language's name in a smaller-sized parenthesis. For example:

Deutschland  (German)

The template's defaults can be overridden and the parenthesis excluded, in which case there may be no visible changes to the text where it's used. An HTML span, however, still identifies the native name as a linguistic element, meaning that web browsers and screen readers can select a particular font, formatting, pronunciation, etc, for it.

Syntax

Common
{{native name|ISO 639 language code|the native name}}

The code for the example at the start of this documentation would, therefore, be:

{{native name|de|Deutschland}}

Parameters

Required parameters shown in bold italics.

Parameter name Description and example/s
[first unnamed] The ISO 639 code for the native language. French, for instance, is "fr"; Spanish is "es"; Arabic is "ar"; etc.
[second unnamed] The native name, in the native language (with accents, etc).
italics
(or italic)
Set to "off" or "no" to disable displaying the native name in italics.
|italics=off
paren
(or icon)
Set to "omit", "off" or "no" to suppress the appearance of the native language's name in a parenthesis after the native name.
|paren=omit
nbsp Set to "omit" or "no" to suppress the addition of a second space between the native name and the native language's name in brackets.
Generally works in tandem with the italics or italic and/or paren or icon switches, as the automatic addition of the second
space prevents the native name in italics from appearing to lean into the following bracket.
|nbsp=omit
parensize
(previously fontsize)
Use to specify a font-size for the parenthesis.
|parensize=90%
nolink Set to anything (e.g. "on") to suppress the appearance of the native language's name as a link.
More complex examples

Code and result for the same name "Deutschland" above but with italics and nbsp switched off, nolink switched on and a parensize of 90%:

{{native name|de|Deutschland|italics=off|nbsp=omit|nolink=on|parensize=90%}}
Deutschland (German)

Retaining no italics but suppressing the parenthesis:

{{native name|de|Deutschland|italics=off|paren=omit}}
Deutschland

This result is the same as if the {{lang}} template had been used.

Other examples

Code Result
{{Infobox settlement
| name = The Hague
| native_name = {{native name|nl|Den Haag}}
}}
Script error: No such module "Settlement short description".
The Hague

Den Haag  (Dutch)
{{Infobox country
| conventional_long_name = French Republic
| native_name = {{native name|fr|République française|paren=omit}}
}}
République française
French Republic

Annotated code

                              width 80 characters
--------------------------------------------------------------------------------
                                                                         Notes
   {{lang
    |   {{{1}}}<!--                                                       [a]
 -->|   {{#switch:{{{italics|{{{italic|}}}}}}|off|no=|''}}<!--
     -->{{{2}}}<!--                                                       [b]
     -->{{#switch:{{{italics|{{{italic|}}}}}}|off|no=|''}}
   }}<!--

-->{{#switch:{{{paren|{{{icon|}}}}}} |omit|off|no= <!--                   [c]
 -->|#default=&nbsp;<!--
     -->{{#switch:{{{italics|{{{italic|}}}}}} |off|no= <!--               [d]
      -->|{{#switch|{{{nbsp|}}}|omit|no=|&nbsp;}}<!--                     [e]
     -->}}<!--
     --><span class="languageicon" style="font-size:{{{parensize|[default]}}};
                                          font-weight:normal;"><!--
         -->{{#if:{{{nolink|}}} |({{ISO 639 name|{{{1}}}}}) <!--          [f]
          -->|  {{#ifexist:Template:ISO 639 name {{{1}}} <!--             [g]
              -->| ([[{{ISO 639 name|{{{1}}}}} language|{{ISO 639 name|{{{1}}}}}]])
                 | (language?)<!--                                        [h]
         -->}}  }}<!--
     --></span><!--
-->}}


--------------------------------------------------------------------------------
Notes legend
 [a] {{{1}}} = ISO 639 language code.
 [b] {{{2}}} = the foreign-language name/phrase, displayed in italics unless
                                                        italics/italic = off/no.
 [c] If paren/icon = omit/off/no, omit following parenthesis;
 [d] else if name/phrase is in italics
 [e] and nbsp isn't omit/no, add an extra space (to ensure italics doesn't lean
                                                          into the parenthesis).
 [f] If nolink set, display unlinked language name in the parenthesis;
 [g] else if an article for this language exists, link to it as "[[(name)
      language|(name)]]" in the parenthesis (eg "([[French language|French]])");
 [h] else return the error query "(language?)".
--------------------------------------------------------------------------------