Template:dir

From GeneWeb
Jump to: navigation, search

ltr

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 Template:uselang.
  • {{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 floatting 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 | arz | bcc | 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
    Examples

    .

    • {{dir|en}}, for English (English), returns ltr

    .

    • {{dir|ar}}, for العربية (العربية), returns rtl

    .

    • {{dir|yi}}, for ייִדיש (ייִדיש), returns rtl

    .

    .

    • {{dir|en|right|left}}, for English (English), returns left

    .

    • {{dir|ar|right|left}}, for العربية (العربية), returns right

    .

    • {{dir|yi|right|left}}, for ייִדיש (ייִדיש), returns right

    .