Template:Lang
Uisage
The purpose of this template is tae indicate that ae piece text is in anither leid (seeleid code).
{{lang|Language tag|Text}}
UseISO 639 leid codes.Exemple (whaarfris the code furFrench):
* 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 theW3C,"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-1is preferrt owerISO 639-2anISO 639-3.
Indicatin writin script
Gin necessar, add theISO 15924code tae indicate the script.
For exemple,Roushieis fir uisual scrieved in theCyrillic alphabet,as sic the 'Cyrl' script code isna needit an the leid code will beruinsteid oru-Cyrl.Houaniver, whan that text istransliteratedtheLatncode (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:
{{lang|ru-Latn|''Moskva''}} is equivalent tae {{transl|ru|''Moskva''}}. To speicify ye ar uisin theISO 9transliteration o Cyrillic, uise {{transl|ru|ISO|''Moskva''}}:
IANAmaintains a list specifying when the script tag should be suppressed[2].In some cases the script must be always specified, likeTajikwhich can be equally written inArabic,Latinor 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 sectionwriting direction).
Indicating regional variant
In some cases, maybe it will be needed to addISO 3166-1 alpha-2country codes (specific usage of that country). Of course the three codes can appear in the same tag, for example the codezh-Hant-TWwill be used forCheenesetext written withTraditional Han characters,containing words or expressions specific toTaiwan.Examples:
* {{lang|zh-Hant-TW| đài loan }}
Results in your browser:
- Đài loan
Writing direction
{{rtl-lang}} is a specific template for right-to-left languages likeArabicorHebrew.
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 forCJKwhere 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: seethis comparison table and screenshot.
- Foraccessibilitypurposes:screen readersneed language info to provide correctly audio output.
- Forspell checkersand grammar checkers.
- To help browsers choosing appropriatequotation marks,and making decisions abouthyphenation,ligatures,and spacing.
- Users can apply styles to languages in theirstyle sheets(useful for editors).
- Google and othersearch enginescan use this information whenindexingtext.
- 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 applyCSSstyles in your user style sheet. Registered users can put styles into User:XXX/monobook.css, whereXXXis the user name.
These examples will not work in Internet Explorer, because it doesn't support attribute selectors. TryFirefox.
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}} andlist 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
- IANA
- IANA Language Subtag Registry
- Tags for Identifying Languages(RFC 4646)
- Matching of Language Tags(RFC 4647)
- Language tags—(obsolete per RFC4646)