Template:Lang

From Wikisource
Jump to: navigation, search
Documentation icon 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.

Usage[edit]

{{lang|language|text}}
{{lang
 | language  = 
 | text      = 
 | direction = 
 | font      = 
}}

Parameters[edit]

  • 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.

Examples[edit]

Hebrew text and unnamed parameters[edit]

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

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

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

Arabic text and named parameters[edit]

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

المدينة‎

Arabic text and non-standard web font[edit]

{{lang|ar|المدينة‎|font=Amiri}}

المدينة‎

Burmese text and different web fonts[edit]

{{lang|my|အ​ကူ​အ​ညီ​}}

အ​ကူ​အ​ညီ​

{{lang|my|အ​ကူ​အ​ညီ​|font=Padauk-Regular}}

အ​ကူ​အ​ညီ​

{{lang|my|အ​ကူ​အ​ညီ​|font=Yunghkio}}

အ​ကူ​အ​ညီ​

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

{{lang|en|Lorem ipsum|font=Perizia}}

Lorem ipsum

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

Lorem ipsum

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

Lorem ipsum

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

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 WebFonts 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.

Language ISO-639 Fonts
Ahirani ahr Lohit Devanagari
Akkadian akk Akkadian
Amharic am Abyssinica SIL
Arabic ar Amiri
Assamese as Lohit Assamese
Bengali bn Lohit Bengali, Siyam Rupali
Bhojpuri bh Lohit Devanagari
Bishnupriya Manipuri bpy Lohit Bengali
Buginese bug Saweri
Burmese my Masterpiece Uni Sans
Padauk-Regular
Myanmar3
Yunghkio
Dzongkha dz Jomolhari
Gujarati gu Lohit Gujarati
Hebrew he Miriam CLM
Taamey Frank CLM
Biblical Hebrew hbo Taamey Frank CLM
Hindi hi Lohit Devanagari
Samyak Devanagari
Kannada kn Lohit Kannada
Kedage
Khmer km KhmerOSbattambang, KhmerOSsiemreap, KhmerOS, KhmerOSbokor, KhmerOSmuollight, KhmerOSmuol, KhmerOSmuolpali, KhmerOSfreehand
Konkani kok Lohit Devanagari
Latin script (Latn)   Perizia
Rufscript
Ubuntu
Latin fraktur script (Latf)   UnifrakturMaguntia
Makassarese mak Saweri
Malayalam ml AnjaliOldLipi
Meera
RaghuMalayalam
Maithili mai Lohit Devanagari
Marathi mr Lohit Devanagari
Samyak Devanagari
Min Dong Chinese cdo Charis SIL
Oriya (Odia) or Lohit Oriya
Utkal
Punjabi pa Lohit Punjabi
Saab
Persian (Farsi) fa IranianSans
Sourashtra saz Pagul
Sanskrit sa Lohit Devanagari, Samyak Devanagari
Tamil ta Lohit Tamil
Thendral
Thenee
Telugu te Lohit Telugu
Pothana2000
Vemana2000
Tibetan bo Jomolhari
Tigrinya ti Abyssinica 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 in a machine readable format. All pages on English Wikisource are 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.

See also[edit]