Template:Native name/doc: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>CsDix
corrected/updated annotated code
meta>CsDix
updating
Line 1: Line 1:
<noinclude>{{documentation subpage}}</noinclude>
<noinclude>{{documentation subpage}}</noinclude>
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
Convenience template to indicate what language a native name of a place (like that of a country or town) belongs to, appending the language name in an icon. Uses {{tl|lang}} and {{tl|language icon}}. It makes the native name appear in italics by default, although this can be overridden, as can the language icon be excluded. Therefore, the template may make no visible changes to the text, but it does add a ''[[Span and div|span]]'' tag with ''language attributes'' around the native name to the page's source code, which can help web browsers choose the right font, screen readers use the right pronunciation and more.
Convenience template, based on {{tl|lang}}, to indicate the language of a place's native name. The language is appended as a parenthesis, in{{spaced ndash}}by current defaults{{spaced ndash}}italics and a slightly smaller size:
: {{native name|de|Deutschland}}


==Usage==
The template's defaults can be overridden and the parenthesis even excluded, in which case there may be no visible changes to the text where it's used. It still, however, identifies the native name as a linguistic element using the [[HTML]] ''[[Span and div|span]]'' tag, which web browsers and [[screen reader]]s can use to select an appropriate font, pronunciation, etc.
{{Pre|{{((}}native name{{!}}''language tag''{{!}}''text''[{{!}}icon{{=}}''no''][{{!}}italic{{=}}''no'']{{))}}}}
:('<tt>[...]</tt>' means 'optional', do not include the square brackets when using this template)
where
*''language tag'' is the code for the native language (see the [[list of ISO 639 codes]]);
*''text'' is the native name;
*<tt>icon</tt> is an optional parameter to exclude the language icon by setting the value to "no";
*<tt>italic</tt> is an optional parameter to prevent the name from appearing in italics by setting the value to "no".


==Examples==
== Usage ==
{{Pre|{{((}}Infobox settlement<br />
 
===Syntax===
; Common
{{pre|{{((}}native name{{!}}''[[ISO 639]] language code''{{!}}''the native name''{{))}} }}
 
So, the code for the example at the top of this page would be <code><nowiki>{{native name|de|Deutschland}}</nowiki></code>.
 
====Parameters====
Required parameters shown in '''''bold italics'''''.
 
{| class="wikitable sortable" style="cellpadding:0.2em;text-align:left;line-height:1.3em;"
! 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''<br/>or ''italic''
| Set to "off" (or "no") to disable displaying the native name in italics.
: <code><nowiki>|italics=off</nowiki></code>
|-
| ''paren''<br/>or ''icon''
| Set to "off" (or "no") to suppress the appearance of the native language's name in barackets after the native name.
: <code><nowiki>|paren=off</nowiki></code>
|-
| ''nbsp''
| Set to "no" to suppress the addition of a second space between the native name and the native language's name in brackets.<br/>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.
: <code><nowiki>|nbsp=no</nowiki></code>
|-
| ''fontsize''
| Use to set a font-size for the language name in brackets that differs from the default.
: <code><nowiki>|fontsize=80%</nowiki></code>
|-
| ''nolink''
| Set to anything (usually "yes") to suppress the appearance of the native language's name as a link.
|}
 
; More complex
Code for the same name "Deutschland" above but with ''italics'' and ''nbsp'' switched off, ''nolink'' switched on and a ''fontsize'' of 80%:
: <code><nowiki>{{native name|de|Deutschland|italics=off|nbsp=off|nolink=yes|fontsize=80%}}</nowiki></code>
Result:
: {{native name|de|Deutschland|italics=off|nbsp=off|nolink=yes|fontsize=80%}}
 
== More examples ==
 
{{pre|{{((}}Infobox settlement<br />
&nbsp;{{!}}name{{=}}The Hague<br />
&nbsp;{{!}}name{{=}}The Hague<br />
&nbsp;{{!}}native_name{{=}}'''{{((}}native name{{!}}nl{{!}}Den Haag{{))}}'''<br />
&nbsp;{{!}}native_name{{=}}'''{{((}}native name{{!}}nl{{!}}Den Haag{{))}}'''<br />
Line 47: Line 89:


===Note===
===Note===
When both the <tt>icon</tt> and <tt>italic</tt> parameters are set to "no" this template is equivalent to the {{tl|lang}} template.
When the ''paren'' or ''icon'' and ''italics'' or ''italic'' parameters are set to "off" (or "no"), this template is equivalent to the {{tl|lang}} template.


== Annotated code ==
== Annotated code ==
Line 56: Line 98:


{{lang |{{{1}}}                                                      <!--[a]-->
{{lang |{{{1}}}                                                      <!--[a]-->
  |<!---->{{#ifeq:{{{italics|{{{italic|}}}}}}|no||''}}<!--
  |<!---->{{#switch:{{{italics|{{{italic|}}}}}}|off|no|''}}<!--
       -->{{{2}}}<!--                                                  <!--[b]-->
       -->{{{2}}}<!--                                                  <!--[b]-->
       -->{{#ifeq:{{{italics|{{{italic|}}}}}}|no||''}}
       -->{{#switch:{{{italics|{{{italic|}}}}}}|off|no|''}}
}}<!--
}}<!--
-->{{#ifeq:{{{paren|{{{icon|}}}}}}|no |                              <!--[c]-->
-->{{#switch:{{{paren|{{{icon|}}}}}}|off|no                           <!--[c]-->
     |&#38;nbsp;{{#ifeq:{{{italic|}}}|no |                                <!--[d]-->
     |&#38;nbsp;{{#switch:{{{italics|{{{italic|}}}}}}|off|no               <!--[d]-->
             |{{#ifeq:{{{nbsp|}}}|no |                                <!--[e]-->
             |{{#ifeq:{{{nbsp|}}}|no |                                <!--[e]-->
               |&#38;nbsp;}}<!--
               |&#38;nbsp;}}<!--

Revision as of 01:53, 2 December 2012

Convenience template, based on {{lang}}, to indicate the language of a place's native name. The language is appended as a parenthesis, inTemplate:Spaced ndashby current defaultsTemplate:Spaced ndashitalics and a slightly smaller size:

Deutschland  (German)

The template's defaults can be overridden and the parenthesis even excluded, in which case there may be no visible changes to the text where it's used. It still, however, identifies the native name as a linguistic element using the HTML span tag, which web browsers and screen readers can use to select an appropriate font, pronunciation, etc.

Usage

Syntax

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

So, the code for the example at the top of this page would 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 "off" (or "no") to suppress the appearance of the native language's name in barackets after the native name.
|paren=off
nbsp Set to "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=no
fontsize Use to set a font-size for the language name in brackets that differs from the default.
|fontsize=80%
nolink Set to anything (usually "yes") to suppress the appearance of the native language's name as a link.
More complex

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

{{native name|de|Deutschland|italics=off|nbsp=off|nolink=yes|fontsize=80%}}

Result:

Deutschland (German)

More examples

{{Infobox settlement
 |name=The Hague
 |native_name={{native name|nl|Den Haag}}
}}

results in

The Hague
Den Haag  (Dutch)

while

{{Infobox settlement
 |name=French Republic
 |native_name={{native name|fr|République française|icon=no}}
}}

results in

French Republic
République française

 

Note

When the paren or icon and italics or italic parameters are set to "off" (or "no"), this template is equivalent to the {{lang}} template.

Annotated code

                              width 80 characters
--------------------------------------------------------------------------------

{{lang |{{{1}}}                                                       <!--[a]-->
 |<!---->{{#switch:{{{italics|{{{italic|}}}}}}|off|no|''}}<!--
      -->{{{2}}}<!--                                                  <!--[b]-->
      -->{{#switch:{{{italics|{{{italic|}}}}}}|off|no|''}}
}}<!--
-->{{#switch:{{{paren|{{{icon|}}}}}}|off|no                           <!--[c]-->
    |&nbsp;{{#switch:{{{italics|{{{italic|}}}}}}|off|no               <!--[d]-->
            |{{#ifeq:{{{nbsp|}}}|no |                                 <!--[e]-->
              |&nbsp;}}<!--
          -->}}<!--
  --><span class="languageicon"
           style="font-size:{{{fontsize|90%}}};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><!--
-->}}


--------------------------------------------------------------------------------
Legend
[a] {{{1}}} = ISO 639 language code.
[b] {{{2}}} = the foreign-language placename. Displayed in italics unless
                                                         italics or italic = no.
[c] If icon or paren=no, omit following linked language name (in brackets).
[d] If placename in italics,
[e] then, unless nbsp=no, add an extra space after it (to stop the italics
                                     leaning into the parenthesis that follows).
[f] If nolink set, display unlinked language name,
[g] else if a link for this language name exists, display it as
             "[[(name) language|(name)]]" (e.g. "([[French language|French]])"),
[h] else return the error query "(language?)".