• Hame
  • Random
  • Nearbi
  • Log in
  • Settins
Donate Now If Wikipedia is useful to you, please give today.
  • Aboot Wikipedia
  • Disclamation
Wikipedia

Template:Lang

  • Leid
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]

Table o contents

  • 1 Uisage
    • 1.1 Indicatin writin script
    • 1.2 Indicating regional variant
    • 1.3 Writing direction
  • 2 Rationale
  • 3 Applying styles
  • 4 See an aa
  • 5 References

Uisage

The purpose of this template is tae indicate that ae piece text is in anither leid (see leid code).

{{lang|Language tag|Text}}

Use ISO 639 leid codes. Exemple (whaar fr is the code fur French):

* She seyed: "{{lang|fr|''Je suis Française.''}}"

Results in yer brouser:

  • She seyed: "[Je suis Française.] error: {{lang}}: text has italic markup (help)"

Also, there is versions o this template for ilka speceific leid that prent the leid's name anaw, meant tae be uised the first time that leid is uised in the airticle. For exemple, "{{lang-es|Español}}" an "{{lang-ru|русский язык}}" gies "Spaingie: Español" an "Roushie: русский язык".

Leid subtags can also be uised tae denote writin script or regional variation o ae leid. Accordin tae the W3C, "The golden rule when creating language tags is to keep the tag as short as possible",[1] so sic subtags shoud anely be eikit gif there is an important raeson tae uise thaim. ISO 639-1 is preferrt ower ISO 639-2 an ISO 639-3.

Indicatin writin script

Gin necessar, add the ISO 15924 code tae indicate the script.

For exemple, Roushie is fir uisual scrieved in the Cyrillic alphabet, as sic the 'Cyrl' script code isna needit an the leid code will be ru insteid o ru-Cyrl. Houaniver, whan that text is transliterated the Latn code (latin script) shoud be uised acause it isnae the defaut script for Roushie: ru-Latn. Exemple:

* Moscow ([[Roushie leid|Roushie]]: {{lang|ru|Москва́}}, {{lang|ru-Latn|''Moskva''}})

whilk is the same as

* Moscow ({{lang-ru|Москва́}}, {{lang|ru-Latn|''Moskva''}})

Results in yer brouser:

  • Moscow (Roushie: Москва́, [Moskva] error: {{lang}}: text has italic markup (help))

{{lang|ru-Latn|''Moskva''}} is equivalent tae {{transl|ru|''Moskva''}}. To speicify ye ar uisin the ISO 9 transliteration o Cyrillic, uise {{transl|ru|ISO|''Moskva''}}:

  • Moscow (Roushie: Москва́, ISO 9: Moskva)

IANA maintains a list specifying when the script tag should be suppressed [2]. In some cases the script must be always specified, like Tajik which can be equally written in Arabic, Latin or Cyrillic alphabets:

* Tajik ({{rtl-lang|tg-Arab|تاجیکی}}, {{lang|tg-Latn|''tojikī''}}, {{lang|tg-Cyrl|тоҷикӣ}})

Which results in your browser:

  • Tajik (تاجیکی‎, [tojikī] error: {{lang}}: text has italic markup (help), тоҷикӣ)

Note the use of {{rtl-lang}} instead of {{lang}} when using the Arabic script (see below section writing direction).

Indicating regional variant

In some cases, maybe it will be needed to add ISO 3166-1 alpha-2 country codes (specific usage of that country). Of course the three codes can appear in the same tag, for example the code zh-Hant-TW will be used for Cheenese text written with Traditional Han characters, containing words or expressions specific to Taiwan. Examples:

* {{lang|zh-Hant-TW|臺灣}}

Results in your browser:

  • 臺灣

Writing direction

{{rtl-lang}} is a specific template for right-to-left languages like Arabic or Hebrew.

for right-to-left paragraphs (as opposed to rtl strings embedded in an English paragraph), use {{rtl-para}}.

Rationale

  • Web browsers can use the information to choose an appropriate font.
    • This is great for CJK where a character can be given its language-specific shape but will fall back to another form if no appropriate font is found or if the preferred font lacks that character, for example because the language does not make use of that character: see this comparison table and screenshot.
  • For accessibility purposes: screen readers need language info to provide correctly audio output.
  • For spell checkers and grammar checkers.
  • To help browsers choosing appropriate quotation marks, and making decisions about hyphenation, ligatures, and spacing.
  • Users can apply styles to languages in their style sheets (useful for editors).
  • Google and other search engines can use this information when indexing text.
  • Could be useful for application developers who re-publish Wikipedia.
  • Could be useful for research or compiling statistics about language use in Wikipedia.

Applying styles

You can apply CSS styles in your user style sheet. Registered users can put styles into User:XXX/monobook.css, where XXX is the user name.

These examples will not work in Internet Explorer, because it doesn't support attribute selectors. Try Firefox.

Example: to apply a font to Roushie-language text:

 span[lang|=ru] { font-family: fonteskaya; }

Example: to apply a colour to text marked with any language:

 span[lang] { color: green; }

Note: don't use quotation marks in your user style sheet. Wikitext will screw them up. They are recommended in CSS, but not required.

See an aa

  • Category:Multilingual support templates
  • List of ISO 639 codes (language codes)
  • List of ISO 15924 codes (script codes)
  • {{rtl-lang}}, for right-to-left scripts like Arabic or Hebrew
  • {{transl}} and list of ISO transliterations
  • {{transl}} for romanisation of languages not natively written in the Latin alphabet.
  • {{latinx}}
  • {{script}}
  • Category:Leid icon templates, Category:Language icons, templates for visually marking external links to foreign-language content

References

  • W3C
    • Language tags in HTML and XML—overview
    • Internationalization Best Practices: Specifying Language in XHTML & HTML Content—W3C Working Draft 21 July 2006
    • Understanding the New Language Tags
    • FAQ: Styling using the lang attribute
  • IANA
    • IANA Language Subtag Registry
    • Tags for Identifying Languages (RFC 4646)
    • Matching of Language Tags (RFC 4647)
    • Language tags—(obsolete per RFC4646)
The above documentation is transcluded from Template:Lang/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Taen frae "https://sco.wikipedia.org/w/index.php?title=Template:Lang&oldid=629831"
Last edited on 21 Februar 2018, at 21:32

Languages

    • Аԥсшәа
    • Acèh
    • Адыгабзэ
    • Afrikaans
    • Alemannisch
    • Алтай тил
    • አማርኛ
    • Aragonés
    • Ænglisc
    • अंगिका
    • العربية
    • ܐܪܡܝܐ
    • الدارجة
    • مصرى
    • অসমীয়া
    • Asturianu
    • Авар
    • अवधी
    • Aymar aru
    • Azərbaycanca
    • تۆرکجه
    • Башҡортса
    • Basa Bali
    • Boarisch
    • Batak Toba
    • Bikol Central
    • Беларуская
    • Беларуская (тарашкевіца)
    • Betawi
    • Български
    • भोजपुरी
    • Banjar
    • ပအိုဝ်ႏဘာႏသာႏ
    • Bamanankan
    • বাংলা
    • བོད་ཡིག
    • বিষ্ণুপ্রিয়া মণিপুরী
    • Brezhoneg
    • Bosanski
    • Basa Ugi
    • Буряад
    • Català
    • 閩東語 / Mìng-dĕ̤ng-ngṳ̄
    • Нохчийн
    • Cebuano
    • Chamoru
    • ᏣᎳᎩ
    • کوردی
    • Corsu
    • Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ
    • Čeština
    • Чӑвашла
    • Cymraeg
    • Dansk
    • Dagbanli
    • Deutsch
    • Zazaki
    • Dolnoserbski
    • डोटेली
    • ދިވެހިބަސް
    • Ελληνικά
    • Emiliàn e rumagnòl
    • English
    • Esperanto
    • Español
    • Eesti
    • Euskara
    • Estremeñu
    • فارسی
    • Fulfulde
    • Suomi
    • Võro
    • Na Vosa Vakaviti
    • Føroyskt
    • Français
    • Arpetan
    • Nordfriisk
    • Gaeilge
    • Gagauz
    • 贛語
    • Kriyòl gwiyannen
    • Gàidhlig
    • Galego
    • گیلکی
    • Avañe'ẽ
    • गोंयची कोंकणी / Gõychi Konknni
    • Bahasa Hulontalo
    • 𐌲𐌿𐍄𐌹𐍃𐌺
    • ગુજરાતી
    • Wayuunaiki
    • Gungbe
    • Gaelg
    • Hausa
    • 客家語 / Hak-kâ-ngî
    • עברית
    • हिन्दी
    • Fiji Hindi
    • Hrvatski
    • Hornjoserbsce
    • Kreyòl ayisyen
    • Magyar
    • Հայերեն
    • Արեւմտահայերէն
    • Interlingua
    • Jaku Iban
    • Bahasa Indonesia
    • Interlingue
    • Igbo
    • Ilokano
    • ГӀалгӀай
    • Ido
    • Íslenska
    • Italiano
    • ᐃᓄᒃᑎᑐᑦ / inuktitut
    • 日本語
    • Patois
    • Jawa
    • ქართული
    • Qaraqalpaqsha
    • Taqbaylit
    • Адыгэбзэ
    • Kabɩyɛ
    • Tyap
    • Kongo
    • Kumoring
    • Gĩkũyũ
    • Қазақша
    • Kalaallisut
    • ភាសាខ្មែរ
    • ಕನ್ನಡ
    • 한국어
    • Перем коми
    • Къарачай-малкъар
    • कॉशुर / کٲشُر
    • Ripoarisch
    • Kurdî
    • Коми
    • Kernowek
    • Кыргызча
    • Latina
    • Ladino
    • Lëtzebuergesch
    • Лакку
    • Лезги
    • Lingua Franca Nova
    • Luganda
    • Ladin
    • Lombard
    • Lingála
    • ລາວ
    • Latgaļu
    • Latviešu
    • मैथिली
    • Basa Banyumasan
    • Мокшень
    • Malagasy
    • Олык марий
    • Māori
    • Minangkabau
    • Македонски
    • മലയാളം
    • Монгол
    • ꯃꯤꯇꯩ ꯂꯣꯟ
    • ဘာသာမန်
    • मराठी
    • Кырык мары
    • Bahasa Melayu
    • Malti
    • Mirandés
    • မြန်မာဘာသာ
    • Эрзянь
    • مازِرونی
    • Nāhuatl
    • Plattdüütsch
    • नेपाली
    • नेपाल भाषा
    • Oshiwambo
    • Li Niha
    • Nederlands
    • Norsk nynorsk
    • Norsk bokmål
    • Novial
    • Nouormand
    • Sesotho sa Leboa
    • Chi-Chewa
    • Occitan
    • Livvinkarjala
    • Oromoo
    • ଓଡ଼ିଆ
    • Ирон
    • ਪੰਜਾਬੀ
    • Pangasinan
    • Kapampangan
    • Papiamentu
    • Picard
    • Naijá
    • Pälzisch
    • Polski
    • Piemontèis
    • پنجابی
    • Português
    • Runa Simi
    • Rumantsch
    • Ikirundi
    • Română
    • Tarandíne
    • Руски
    • Русский
    • Русиньскый
    • Ikinyarwanda
    • संस्कृतम्
    • Саха тыла
    • ᱥᱟᱱᱛᱟᱲᱤ
    • Sardu
    • Sicilianu
    • سنڌي
    • Davvisámegiella
    • Srpskohrvatski / српскохрватски
    • Taclḥit
    • တႆး
    • සිංහල
    • Simple English
    • Slovenčina
    • سرائیکی
    • Slovenščina
    • Anarâškielâ
    • Soomaaliga
    • Shqip
    • Српски / srpski
    • Sranantongo
    • Seeltersk
    • Sunda
    • Svenska
    • Kiswahili
    • ꠍꠤꠟꠐꠤ
    • Ślůnski
    • Sakizaya
    • தமிழ்
    • ತುಳು
    • ᥖᥭᥰ ᥖᥬᥲ ᥑᥨᥒᥰ
    • తెలుగు
    • Тоҷикӣ
    • ไทย
    • ትግርኛ
    • Türkmençe
    • Tagalog
    • Tolışi
    • Setswana
    • Lea faka-Tonga
    • Tok Pisin
    • Türkçe
    • Xitsonga
    • Татарча / tatarça
    • ChiTumbuka
    • Reo tahiti
    • Тыва дыл
    • Удмурт
    • ئۇيغۇرچە / Uyghurche
    • Українська
    • اردو
    • Oʻzbekcha / ўзбекча
    • Tshivenda
    • Vèneto
    • Tiếng Việt
    • Walon
    • Winaray
    • 吴语
    • Хальмг
    • IsiXhosa
    • მარგალური
    • ייִדיש
    • Yorùbá
    • Vahcuengh
    • ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ
    • 中文
    • 文言
    • 閩南語 / Bân-lâm-gú
    • 粵語
    • IsiZulu
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page wis last eeditit on 21 Februar 2018, at 21:32.
    • Content is available unner CC BY-SA 4.0 unless itherwise notit.
    • Preevacie policie
    • Aboot Wikipedia
    • Disclamation
    • Code of Conduct
    • Deveelopers
    • Statistics
    • Cookie statement
    • Terms o Uiss
    • Desktap