Template:GetFallback0

From Wikimedia Commons, the free media repository
Jump to: navigation, search

en

Documentation icon Documentationviewedithistorypurge

This documentation is transcluded from Template:GetFallback0/doc.

Test for the presence of a fallback subpage within a specified template (when the non-fallback language specified in parameter does not provide some resource), and returns its code.

If no subpage is found matching the fallback languages returned by either {{GetFallback}} or {{GetFallback2}}, then this template will return the default content language code of the project (as reported by {{CONTENTLANGUAGE}}).

Usage

{{GetFallback0 |1= |2= }}

Fallback languages are determined in {{GetFallback}} and {{GetFallback2}}. When this template is used, it cannot test that the subpage discovered is a redirect : no fallback language determined in {{GetFallback}} and {{GetFallback2}} should be redirects, otherwise a template inclusion loop may occur, if a template uses this template (or {{Fallback}}) to retrieve an alternate translation for missing resources that it does not define itself.

For example the fallback of "pt-br" should be "pt", but there must not be any redirect from the fallback subpage "/pt" to "/pt-br" in the rendered page (but the reverse is possible to avoid using this template). The same is true for a subpage "/zh" that must not be redirected to "/zh-hans" or "/zh-hant" (but here also it is safe to create a redirect from "/zh-hans" and/or "/zh-hant" to "/zh").

Template parameters

Parameter Description Default Status
1 The name of the template whose localized subpages are being searched for. empty required
2 The language code of a source language from which the code of an existing fallback subpage is being searched for. The value of the current user's UI language, as returned by {{int:lang}}. optional

Additional information

The template is intended to be used in the following namespaces: no namespace specified

The template is intended to be used by the following user groups: no user group specified

Relies on:
{{GetFallback}}, {{GetFallback2}}

See also

{{Fallback}}

Examples

The following examples are testing the existence of fallback subpages within template {{Language}}, and return their code.

You may click on the following link to select another UI language. This page in other languages : English | French | Brazilian Portuguese | Low German | Low Saxon | Dutch | Portuguese | Chinese | Simplified Chinese | Simplified Chinese

Code Renders as
The project's default language is "{{CONTENTLANGUAGE}}". The project's default language is "en".
{{GetFallback0|Language|{{CONTENTLANGUAGE}}}} en
The current UI language is "{{int:lang}}". The current UI language is "en".
{{GetFallback0|Language|{{int:lang}}}} en
{{GetFallback0|Language}} en
{{GetFallback0|Language|pt-br}} en
{{GetFallback0|Language|pt}} en
{{GetFallback0|Language|zh-hans}} en
{{GetFallback0|Language|zh-hant}} en
{{GetFallback0|Language|zh}} en