Template:Lang
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:
{{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''}}:
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
- IANA
- IANA Language Subtag Registry
- Tags for Identifying Languages (RFC 4646)
- Matching of Language Tags (RFC 4647)
- Language tags—(obsolete per RFC4646)