The purpose of this template is to indicate that a given span of text belongs to a particular language (seelanguage code). It often makes no visible changes to the text, but can help web browsers choose the right font, screen readers use the right pronunciation and more,as explained here.
{{lang|Language tag|Text}}UseISO 639 language codes. Example (wherefr is the code forزبان فرانسوی):
* She said: "{{lang|fr|''Je suis française.''}}"Results in your browser:
- She said: "[Je suis française.]Error: {{Lang}}: متن دارای نشانهگذاری ایتالیک است (راهنما)"
This template also includes a categorisation link when used by main namespace pages, therefore it should not be included inside a wikilink. This error may not be immediately obvious if it is used via another template namespace page. If appropriate, the entire wikilink may be fed to the template instead:{{lang|ar|[[زبان عربی]]}}. By default, this template will place articles into the relevant subcategory ofرده:Articles containing non-English language text. To suppress this, add the parameter|nocat=true.
There are also versions of this template for specific languages that also print the language's name, intended to be used the first time that language is used in the article. For example,"{{lang-es|español}}" and"{{lang-ru|русский язык}}" give "اسپانیایی:español" and "روسی:русский язык".
Language subtags can also be used to indicate the writing script or regional variant of a language. According to theکنسرسیوم وب جهانشمول, "the golden rule when creating language tags is to keep the tag as short as possible",[۱] so such subtags should only be added if there is an important reason to use them.ایزو ۶۳۹-۱ is preferred overایزو ۶۳۹-۲ andایزو ۶۳۹-۳.
Indicating writing script
If necessary, add theISO 15924 code to indicate the script.
For example,زبان روسی is usually written in theالفبای سیریلیک, therefore the 'Cyrl' script code is superfluous and the language code will beru instead ofru-Cyrl. However, when that text isنویسهگردانی thetransl code (transliteration) should be used because it isn't the default script for Russian:ru-Latn. Example:
* Moscow ([[زبان روسی]]: {{lang|ru|Москва́}}, {{transl|ru|''Moskva''}})which is the same as
* Moscow ({{lang-ru|Москва́}}, {{transl|ru|''Moskva''}})Results in your browser:
- Moscow (روسی:Москва́,Moskva)
Instead of using{{transl|ru|''Moskva''}} the{{lang|ru-Latn|''Moskva''}} can be used, but if you specified a font and a size for the target language in yourcustom CSS (seeHelp:User style), the transliteration will appear in that specified style. To specify a transliteration scheme, for example, you are using theISO 9 transliteration of Cyrillic, use{{transl|ru|ISO|''Moskva''}}:
Theآیانا maintains a list specifying when the script tag should be suppressed[۲]. In some cases, the script must be always specified, likeفارسی تاجیکی which can be equally written inArabic,Latin orالفبای سیریلیک alphabets:
* Tajik ({{rtl-lang|tg-Arab|تاجیکی}}, {{transl|tg|''tojikī''}}, {{lang|tg-Cyrl|тоҷикӣ}})Which results in your browser:
- Tajik (تاجیکی,tojikī,тоҷикӣ)
Note the use of {{rtl-lang}} instead of {{lang}} when using the Arabic script (see below sectionwriting direction).
Undetermined language
The {{lang}} template is not only used to specify the language of foreign words, but also to specify a single symbol or character in a specific script, for example when discussing about a specific writing system. Many times the character/symbol is used in several languages, but when the article refers to theنویسهواره itself theایزو ۶۳۹-۲ andایزو ۶۳۹-۳ language codeund for Undetermined language. For example:
The {{lang|und-Hani|字}} Han character has 6 strokes.- The字 Han character has 6 strokes.
Han characters are used in Chinese, Japanese, sometimes Korean, and formerly Vietnamese, and in this case the character is not used for any specific language. Note that the script code used isHani, which specifies generic Han characters (Hanzi, Kanji, Hanja).
Compare {{script}}
The {{script|Hani|字}} Han character has 6 strokes.- The字 Han character has 6 strokes.
Indicating regional variant
In some cases, maybe it will be needed to addایزو ۳۱۶۶-۱ آلفا-۲ country codes (specific usage of that country). Of course the three codes can appear in the same tag, for example the codezh-Hant-TW will be used forزبانهای چینی text written withنویسههای چینی سنتی, containing words or expressions specific toتایوان.zh-Hans is for simplified. Examples:
* {{lang|zh-Hant-TW|臺灣}}Results in your browser:
Writing direction
{{rtl-lang}} is a specific template for right-to-left languages likeزبان عربی orزبان عبری.
For right-to-left paragraphs (as opposed to rtl strings embedded in an English paragraph), use {{rtl-para}}.
Rationale
Applying styles
You can applyبرگههای سبک آبشاری styles in your user style sheet. Registered users can put styles into User:XXX/monobook.css, whereXXX is the user name.
These examples may work inاینترنت اکسپلورر ۸; prior versions do not support attribute selectors. Alternatively, tryanother browser such asفایرفاکس موزیلا.
Example: to apply a font to Russian-language text:
span[lang|=ru] { font-family: fonteskaya; }Example: to apply a colour to text marked with any language:
span[lang] { color: green; }Donot use quotation marks in your user style sheet; wikitext will screw them up. They are recommended in CSS, but not required other than for font families containing generic-family keywords ('inherit', 'serif', 'sans-serif', 'monospace', 'fantasy', and 'cursive'). Seehttp://www.w3.org/TR/CSS21/fonts.html#font-family-prop for details.
See also
References