From Wikisource
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]


This template tags pieces of text with the appropriate language code and allows for the implementation of Web Fonts.

This template is a <span> template.
{{lang block}} is the <div> version of this template.

 | language  = 
 | text      = 
 | direction = 
 | font      = 
 | style     =
 | attr      =
 | inline    =


  • language: (Also lang or the first unnamed parameter) The code for the language being displayed, using ISO 639
  • text: (Also the second unnamed parameter) The text to be displayed.
  • direction: (Also dir) Text direction, can be ltr (left-to-right) or rtl (right-to-left). Left-to-right is standard; right-to-left is used for languages such as Arabic and Hebrew. If this is not set, the template will attempt to select the correct text direction based on the language parameter.
  • font: Uses the webfont extension. See Web Fonts below.
  • style: The code for other optional CSS style being applied, such as font-feature-setting: 'locl'; for localized glyph(s).
  • attr: The code for other optional attributes being applied, such as class="plainlinks".

Internal parameters[edit]

This parameter is for internal use only, to distiguish between {{lang}} and {{lang block}}.
It shall not be used directly.

  • inline: The type of template:
    • inline=yes (default) will provide an inline template (<span> ... </span>); this is used internally in {{lang}}.
    • inline=no (or != yes) will provide a block template (<div> ... </div>); this is used internally in {{lang block}}.


Hebrew text and unnamed parameters[edit]

{{lang|he|ארץ זבת חלב ודבש}}

ארץ זבת חלב ודבש

The same text without this template: ארץ זבת חלב ודבש

Arabic text and named parameters[edit]

 | language = ar
 | text     = المدينة‎
 | dir      = rtl


Arabic text and non-standard web font[edit]



Burmese text and different web fonts[edit]







English text (Latin script) with web font[edit]

{{lang|text=Lorem ipsum|font=Rufscript}}

Lorem ipsum

{{lang|text=Lorem ipsum|font=Ubuntu}}

Lorem ipsum

{{lang|text=Lorem ipsum|font=UnifrakturMaguntia}}

Lorem ipsum

{{lang|en|Lorem ipsum|font=Linux Libertine}}

Lorem ipsum

Language attribute[edit]

As stated under parameters, the language should be set with an ISO 639 language code.

However, if necessary, this can be specified even further with an ISO 15924 script code and/or an ISO 3166-1 country code. Script codes can be used if the text is in a script other than that associated with the language. Country codes can be used to specify the text's country of origin.

Use Text Attribute Code Notes
Language Χαίρε, ω χαίρε Ελευθεριά! el {{lang|el|Χαίρε, ω χαίρε Ελευθεριά!}} Greek text. "el" = Greek language.
Script Haire, o haire, Eleftheria! el-Latn {{lang|el-Latn|Haire, o haire, Eleftheria!}} Transliterated into Latin script. "Latn" = Latin script.
Country Χαίρε, ω χαίρε Ελευθεριά! el-GR {{lang|el-GR|Χαίρε, ω χαίρε Ελευθεριά!}} Greek origin. "GR" = Greece.
Script & Country Haire, o haire, Eleftheria! el-Latn-GR {{lang|el-Latn-GR|Haire, o haire, Eleftheria!}} Greek language in Latin script from Greece.
See IETF language tag on Wikipedia for more information.

Web Fonts[edit]

This template makes use of the Universal Language Selector extension installed on this project. This extension allows for the proper display of languages where the standard font is either unavailable or of insufficient quality.

The language parameter will determine which font is used. In some cases, multiple fonts are available; the preferred font can be selected with the font parameter. If the font parameter is not used, the default font for that language will be selected. Currently no support for mobile devices.

Language ISO-639 Fonts
Ahirani ahr Lohit Devanagari
Akkadian akk Akkadian
Amharic am Abyssinica SIL
Arabic (Naskh script) ar Amiri
Nastaʿlīq script (Aran) Hussaini Nastaleeq
Assamese as Lohit Assamese
Bengali bn Lohit Bengali, Siyam Rupali
Bhojpuri bh Lohit Devanagari
Bishnupriya Manipuri bpy Lohit Bengali
Buginese bug Saweri
Burmese my Padauk-Regular
Dzongkha dz Jomolhari
Gujarati gu Lohit Gujarati
Hebrew he Alef
Miriam CLM
Taamey Frank CLM
Biblical Hebrew hbo Taamey Frank CLM
Hindi hi Lohit Devanagari
Samyak Devanagari
Kannada kn Lohit Kannada
Khmer km Hanuman, KhmerOSbattambang, KhmerOS, Nokora, Suwannaphum
Konkani kok Lohit Devanagari
Latin script (Latn)   Charis SIL
Doulos SIL
Gentium Plus
Linux Libertine
Latin fraktur script (Latf)   UnifrakturMaguntia
Makassarese mak Saweri
Malayalam ml AnjaliOldLipi
Maithili mai Lohit Devanagari
Marathi mr Lohit Devanagari
Samyak Devanagari
Min Dong Chinese cdo Charis SIL
Doulos SIL
Oriya (Odia) or Lohit Oriya
Punjabi pa Lohit Punjabi
Persian (Farsi) fa IranianSans
Sourashtra saz Pagul
Sanskrit sa Lohit Devanagari, Samyak Devanagari
Tamil ta Lohit Tamil
Telugu te Lohit Telugu
Tibetan bo Jomolhari
Tigrinya ti Abyssinica SIL
Yi yi Nuosu SIL
See here for a list of all available fonts.

Language tagging[edit]

Texts on Wikisource should be tagged to specify the language in a machine readable format. All pages on English Wikisource are automatically tagged as "English". Any piece of text that is not in English should be tagged as such with this template or one of its derivatives.

Language tagging on Meta-Wiki explains the best practice of language tagging.

Blocks split across pages[edit]

For blocks in a different language split across multiple pages, use {{lang block/s}} to begin the block and {{lang block/e}} to end it. {{lang block/s}} takes the same parameters as {{lang}} except for |inline=, which is fixed as "no".

See also[edit]