Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:LanguageSelector/doc: Difference between revisions

Template page
added language resources, subsection headers for See also
update
 
(50 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{TemplateBox
{{TemplateBox
|1= flags
|1=icons
|1d= "yes" or "only" or anything else, depending on whether you want to see flags and text, only flags and no text, or only text and no flags. (only is not yet implemented)
|1d=determines what is displayed
|1def= "yes"
* '''yes''': icons and text
|1stat= optional
* '''only''': only icons, no text
|2= <unnamed parameter>
* '''code''': English language codes
|2d= If present, a link for the corresponding language will be produced. Up to eight languages can currently be specified, and will display in the order indicated by the parameter sequence. If no unnamed parameters are specified, all languages will be displayed in the default order.
* '''anything else''': only text, no icons
|2def= optional
|1def='''yes'''
|1stat=optional
|2=<unnamed parameters, numbered 2..40>
|2d=A language code. If present, a link for the corresponding language will be produced. Up to 19 language codes can currently be specified, and will display in the order indicated by the parameter sequence. If no unnamed parameters are specified, all languages will be displayed in the default order.
|2def=optional
|3=notpiol
|3d=dummy parameter, if assigned any value, it will suppress the 'This page in other languages: ' text
|3def=optional
|4=action
|4d=passed through to {{tl|UselangLink}}, read documentation there for further information
|4def=optional
|name={{BASEPAGENAME}}
|name={{BASEPAGENAME}}
|desc=Displays a configurable series of languages to display a given page in. It is intended to complement {{tl|LangSwitch}}, but you might find previously unintended uses. ;)
|desc=Displays a configurable set of links that switch the page it's used on to another language. It is intended to complement {{tl|LangSwitch}}, but you might find previously unintended uses. ;)
|namespace=all
|namespace=all
|usergroup=all
|usergroup=all
|placement=
|placement=
|usage-notes=A few examples:
|usage-notes=
<table>
<tr><td><code><nowiki>{{LanguageSelector}}</nowiki></code></td><td>{{LanguageSelector}}</td></tr>
<tr><td><code><nowiki>{{LanguageSelector|flags=no}}</nowiki></code></td><td>{{LanguageSelector|flags=no}}</td></tr>
<tr><td><code><nowiki>{{LanguageSelector|flags=only}}</nowiki></code></td><td>{{LanguageSelector|flags=only}}</td></tr>
<tr><td><code><nowiki>{{LanguageSelector|zh|de}}</nowiki></code></td><td>{{LanguageSelector|zh|de}}</td></tr>
</table>
*The switch only applies to the page the template is transcluded on, clicking other links will return you to the language set in your MediaWiki preferences. This does not generally apply to script calls, e. g. "hide/show" links, or controls for sortable tables or other embedded stuff.
*The switch only applies to the page the template is transcluded on, clicking other links will return you to the language set in your MediaWiki preferences. This does not generally apply to script calls, e. g. "hide/show" links, or controls for sortable tables or other embedded stuff.
* The template can be used inline, it should not break any layout.
* The template can be used inline, it should not break any layout.
Line 25: Line 29:
|i18n-method=
|i18n-method=
|i18n-desc=
|i18n-desc=
|seealso= === Related templates ===
|seealso=
{{tl|LangSwitch}}
=== Related templates ===
* {{tl|Language versions}}
* {{tl|autotranslate}} "used to show a template in the user's interface language"
* {{tl|LangSwitch}} marks up translations of a given string, from which an appropriate language to display is selected based upon user preferences, resorting to default fallback languages when the requested one is not available
* {{tl|LanguageSelectorFlags}} alias for {{tl|LanguageSelector}}
* {{tl|LanguageSelectorNoFlags}} wrapper that changes default behavior to {{codef|1=icons=no}}
* {{tl|Fallback}} determines fallback language when the desired one isn't available, uses {{tl|GetFallback}} and {{tl|GetFallback2}} (secondary fallback language)


=== Language resources ===
=== Language resources ===
If you want to add languages, the following resources might be useful
If you want to add languages, the following resources might be useful
* [[:Category:Flags of languages]] flags
* [[User:Paradoctor/WikipediaLanguages]] list of all Wikipedia languages as of 12 January 2010
* [[:Category:Flags of languages]]
* [[w:ISO-639]] two- and three-letter language codes
* [[w:ISO-639]] two- and three-letter language codes
* [[w:List of languages by name|List of languages by English name]]
* [[w:List of languages by name|List of languages by English name]]
* for names of languages in their own writing systems, you can plunder any article with lots of interwiki links, like [[w:sex]]
* [[w:List of indigenous language names|List of languages in in their own writing systems]], you can also plunder any article with lots of interwiki links, like [[w:sex]]
* [[meta:List of Wikipedias]] at Meta
* [[incubator:Main_Page]] list of proposed projects at Incubator
|setscats=
|setscats=
|lines=
|lines=
|shorthand=
|shorthand=
|relieson={{tl|LanguageSelector/full}}, {{tl|LanguageSelector/switch}}, {{tl|LanguageSelector/link}}
|relieson=
* {{tl|LanguageSelector/full}} produces a default set when no languages are specified
* {{tl|LanguageSelector/switch}} maps language codes to icons
* {{tl|LanguageSelector/link}} produces a link to a single language, optionally with icon
** {{tl|UselangLink}}
* {{tl|LanguageSelector/ThisPageIn}} returns "This page in other languages", supports LangSwitch
* {{tl|LanguageSelector/InterLanguageSpacer}} used to separate the language links from each other
* {{tl|LanguageSelector/iconfile}} returns filename of default icon for given language code
* {{tl|LanguageSelector/IfPageExists}} cheap replacement for #ifexist: parser extension function
}}
}}
== Examples ==
<table class="wikitable" width="100%">
<tr><th scope="col">Code</th><th scope="col">Rendering on page</th></tr>
<tr><td>{{tlc|LanguageSelector|de|en|fr|invalid}}</td><td style="background:#FFF">{{LanguageSelector|de|en|fr|invalid}}</td></tr>
<tr><td>{{tlc|LanguageSelector|de|en|fr|invalid|6=action=edit}}</td><td style="background:#FFF">{{LanguageSelector|de|en|fr|invalid|action=edit}}</td></tr>
<tr><td>{{tlc|LanguageSelector|de|en|fr|invalid|6=icons=code}}</td><td style="background:#FFF">{{LanguageSelector|de|en|fr|invalid|icons=code}}</td></tr>
<tr><td>{{tlc|LanguageSelector|de|en|fr|5=notpiol=1}}</td><td style="background:#FFF">{{LanguageSelector|de|en|fr|invalid|notpiol=1}}</td></tr>
<tr><td>{{tlc|LanguageSelector|de|en|fr|5=notpiol=1|6=icons=yes}}</td><td style="background:#FFF">{{LanguageSelector|de|en|fr|notpiol=1|icons=yes}}</td></tr>
<tr><td>{{tlc|LanguageSelector|de|en|fr|5=notpiol=1|6=icons=code}}</td><td style="background:#FFF">{{LanguageSelector|de|en|fr|notpiol=1|icons=code}}</td></tr>
<tr><td>{{tlc|LanguageSelector|de|en|fr|5=notpiol=1|6=icons=only}}</td><td style="background:#FFF">{{LanguageSelector|de|en|fr|notpiol=1|icons=only}}</td></tr>
</table>
There are more examples with the default full list of languages on [[Template:LanguageSelector/doc/examples]].
: ''(Dont put examples with all languages here at it would break the transclusion of the documentation subpage in the main template page).''
{{DEFAULTSORT:LanguageSelector}}
<includeonly>
[[Category:Function templates]]
[[Category:Internationalization templates]]
</includeonly>

Latest revision as of 09:33, 26 January 2021

Displays a configurable set of links that switch the page it's used on to another language. It is intended to complement {{LangSwitch}}, but you might find previously unintended uses. ;)

Usage

{{LanguageSelector |icons= |<unnamed parameters, numbered 2..40>= |notpiol= |action= }}

  • The switch only applies to the page the template is transcluded on, clicking other links will return you to the language set in your MediaWiki preferences. This does not generally apply to script calls, e. g. "hide/show" links, or controls for sortable tables or other embedded stuff.
  • The template can be used inline, it should not break any layout.

Template parameters

ParameterDescriptionDefaultStatus
iconsdetermines what is displayed
  • yes: icons and text
  • only: only icons, no text
  • code: English language codes
  • anything else: only text, no icons
yesoptional
<unnamed parameters, numbered 2..40>A language code. If present, a link for the corresponding language will be produced. Up to 19 language codes can currently be specified, and will display in the order indicated by the parameter sequence. If no unnamed parameters are specified, all languages will be displayed in the default order.optionaloptional
notpioldummy parameter, if assigned any value, it will suppress the 'This page in other languages: ' textoptionaloptional
actionpassed through to {{UselangLink}}, read documentation there for further informationoptionaloptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Relies on:

See also

Language resources

If you want to add languages, the following resources might be useful

Examples

CodeRendering on page
{{LanguageSelector|de|en|fr|invalid}}
{{LanguageSelector|de|en|fr|invalid|action=edit}}
{{LanguageSelector|de|en|fr|invalid|icons=code}}
{{LanguageSelector|de|en|fr|notpiol=1}}
{{LanguageSelector|de|en|fr|notpiol=1|icons=yes}}
{{LanguageSelector|de|en|fr|notpiol=1|icons=code}}
{{LanguageSelector|de|en|fr|notpiol=1|icons=only}}

There are more examples with the default full list of languages on Template:LanguageSelector/doc/examples.

(Dont put examples with all languages here at it would break the transclusion of the documentation subpage in the main template page).


Cookies help us deliver our services. By using our services, you agree to our use of cookies.