Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopaedia
Rake

Template:Lang

Permanently protected template
Frae Wikipedia, the free beuk o knawledge
Template documentation[view][edit][history][purge]

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 (whaarfr is 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", so sic subtags shoud anely be eikit gif there is an important raeson tae uise thaim.ISO 639-1 is preferrt owerISO 639-2 anISO 639-3.

Indicatin writin script

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

For exemple,Roushie is fir uisual scrieved in theCyrillic alphabet, as sic the 'Cyrl' script code isna needit an the leid code will beru insteid oru-Cyrl. Houaniver, whan that text istransliterated theLatn 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 theISO 9 transliteration o Cyrillic, uise {{transl|ru|ISO|''Moskva''}}:

IANA maintains a list specifying when the script tag should be suppressed. In some cases the script must be always specified, likeTajik which can be equally written inArabic,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 sectionwriting direction).

Indicating regional variant

In some cases, maybe it will be needed to addISO 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 codezh-Hant-TW will be used forCheenese text written withTraditional Han characters, containing words or expressions specific toTaiwan. Examples:

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

Results in your browser:

  • 臺灣

Writing direction

{{rtl-lang}} is a specific template for right-to-left languages likeArabic orHebrew.

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 forCJK 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: seethis comparison table and screenshot.
  • Foraccessibility purposes:screen readers need language info to provide correctly audio output.
  • Forspell checkers and 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 engines can use this information whenindexing 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 applyCSS styles in your user style sheet. Registered users can put styles into User:XXX/monobook.css, whereXXX is 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

References

The abovedocumentation istranscluded fromTemplate: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"
Categeries:

[8]ページ先頭

©2009-2025 Movatter.jp