Template:Dir: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
No edit summary
Line 1: Line 1:
<big><big><big><big><big><big><div style="text-align:center; width:auto; margin-left:auto; margin-right:auto;"><big><big><big><big><big><big><big><big><big>'''WIKIMEDIA
{{#switch:{{{1}}}|ar|arc|arz|azb|bcc|bgn|ckb|bqi|dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi={{{2|rtl}}}|{{{3|ltr}}}}}<noinclude>
REVOLUTION'''</big></big></big></big></big></div><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big>dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi={{{2|rtl}}}|{{{3|ltr}}}}}
{{documentation}}
{{documentation}}



Revision as of 03:34, 25 April 2019

WIKIMEDIA REVOLUTION

dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template documentation

Usage

Outputs "rtl" for right-to-left languages else "ltr". The default returned values "rtl" and "ltr" can also be customized.

Syntax

  • {{dir|language-code}}
    The language-code parameter should be conforming to BCP47, as required by web standards (HTML/CSS …), rather than Wikimedia labels for designating languages in domain names (in some cases, Wikimedia language codes are not conforming and only used for interwikis and URLs; most of them are being migrated to BCP47, which is based on some parts of the ISO649 standard).
    If no language-code parameter is specified, it defaults to the preferred UI language of the visitor viewing the current page, which for you is currently en.
  • {{dir|language-code|return value for RTL scripts|return value for LTR scripts}}
    The 2nd and 3rd (optional) parameters allows changing the default return values for languages written in RTL and LTR scripts, whose default are respectively "rtl" and "ltr".
    This can be used to customize CSS styles such as text alignment or floating side or lateral margins/borders/paddings, or to change the displayed text/symbols or names of images/icons depending on the script direction.

Note

Currently it recognizes the following codes of languages usually written in a right-to-left script:

ar | arc | ary | arz | azb | bcc | ckb | bgn | bqi | dv | fa | fa-af | glk | ha-arab | he | kk-arab | kk-cn | ks | ku-arab | mzn | pnb | prd | ps | sd | ug | ur | ydd | yi

Languages to add (see talk page):

Examples

  • {{dir}}, for the current user language which is English (<span lang="en" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">English), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation </noinclude>.

  • {{dir|en}}, for English (<span lang="en" dir="
    WIKIMEDIA
REVOLUTION

dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">English), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation </noinclude>. (should be ltr)

  • {{dir|ar}}, for Arabic (<span lang="ar" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">العربية), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation </noinclude>. (should be rtl)

  • {{dir|yi}}, for Yiddish (<span lang="yi" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">ייִדיש), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation </noinclude>. (should be rtl)

  • {{dir|bgn}}, for Western Balochi (<span lang="bgn" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">روچ کپتین بلوچی), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation </noinclude>. (should be rtl)

  • {{dir|2=right|3=left}}, for the current user language which is English (<span lang="en" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">English), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=right|left}}

Template loop detected: Template:Documentation </noinclude>.

  • {{dir|en|right|left}}, for English (<span lang="en" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">English), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=right|left}}

Template loop detected: Template:Documentation </noinclude>.

  • {{dir|ar|right|left}}, for Arabic (<span lang="ar" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">العربية), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=right|left}}

Template loop detected: Template:Documentation </noinclude>.

  • {{dir|yi|right|left}}, for Yiddish (<span lang="yi" dir="
    WIKIMEDIA
REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=rtl|ltr}}

Template loop detected: Template:Documentation

</noinclude>">ייִדיש), returns
WIKIMEDIA REVOLUTION
dv|fa|fa-af|glk|ha|he|kk-arab|kk-cn|ks|ku-arab|mzn|pnb|prd|ps|sd|ug|ur|ydd|yi=right|left}}

Template loop detected: Template:Documentation </noinclude>.

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools.

TemplateData for Dir

Outputs “rtl” for right-to-left languages, else “ltr”. The default returned values “rtl” and “ltr” can also be customized.

Template parameters

ParameterDescriptionTypeStatus
Language1

The language to get the direction for, by default the interface language

Default
{{int:lang}}
Example
{{PAGELANGUAGE}}
Linerequired
Right-to-Left2

Return value for right-to-left languages

Default
rtl
Example
left
Stringoptional
Left-to-Right3

Return value for left-to-right languages

Default
ltr
Example
right
Stringoptional
Edit parameter translations