Template:Native name/doc: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>CsDix m →Annotated code: parfenthesis |
meta>CsDix corrected/updated annotated code |
||
Line 55: | Line 55: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
{{lang | {{lang |{{{1}}} <!--[a]--> | ||
|<!---->{{#ifeq:{{{italics|{{{italic|}}}}}}|no||''}}<!-- | |||
|{{#ifeq:{{{italic|}}}|no||''}}{{{2}}}{{#ifeq:{{{italic|}}}|no||''}} | -->{{{2}}}<!-- <!--[b]--> | ||
-->{{#ifeq:{{{italics|{{{italic|}}}}}}|no||''}} | |||
}}<!-- | }}<!-- | ||
-->{{#ifeq:{{{paren|{{{icon|}}}}}}|no | <!--[c]--> | -->{{#ifeq:{{{paren|{{{icon|}}}}}}|no | <!--[c]--> | ||
Line 64: | Line 65: | ||
|&nbsp;}}<!-- | |&nbsp;}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
--><span class="languageicon" | |||
style="font-size:{{{fontsize|90%}}};font-weight:normal;"><!-- | |||
-->{{#ifexist:Template:ISO 639 name {{{1}}} | -->{{#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><!-- | |||
-->}} | -->}} | ||
Line 76: | Line 79: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Legend | Legend | ||
[a] | [a] {{{1}}} = ISO 639 language code. | ||
[b] | [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). | [c] If icon or paren=no, omit following linked language name (in brackets). | ||
[d] If placename in italics, | [d] If placename in italics, | ||
[e] then, unless nbsp=no, add an extra space after it (to stop the italics | [e] then, unless nbsp=no, add an extra space after it (to stop the italics | ||
leaning into the parenthesis that follows). | leaning into the parenthesis that follows). | ||
[f] If a link for this language name exists, | [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?)". | |||
</pre> | </pre> | ||
Revision as of 00:45, 2 December 2012
This is a documentation subpage for Template:Native name. It may contain usage information, categories and other content that is not part of the original template page. |
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 {{lang}} and {{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 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.
Usage
{{native name|language tag|text[|icon=no][|italic=no]}}
- ('[...]' 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;
- icon is an optional parameter to exclude the language icon by setting the value to "no";
- italic is an optional parameter to prevent the name from appearing in italics by setting the value to "no".
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 both the icon and italic parameters are set to "no" this template is equivalent to the {{lang}} template.
Annotated code
width 80 characters -------------------------------------------------------------------------------- {{lang |{{{1}}} <!--[a]--> |<!---->{{#ifeq:{{{italics|{{{italic|}}}}}}|no||''}}<!-- -->{{{2}}}<!-- <!--[b]--> -->{{#ifeq:{{{italics|{{{italic|}}}}}}|no||''}} }}<!-- -->{{#ifeq:{{{paren|{{{icon|}}}}}}|no | <!--[c]--> | {{#ifeq:{{{italic|}}}|no | <!--[d]--> |{{#ifeq:{{{nbsp|}}}|no | <!--[e]--> | }}<!-- -->}}<!-- --><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?)".