Template:Lang/doc: Difference between revisions

[checked revision][checked revision]
Content deleted Content added
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 115:
{{section link|Wikipedia:Manual of Style/Text formatting|Foreign terms}} requires the use of {{tl|lang}} instead of manual <nowiki>''italics''</nowiki>. This is preferred for the following reasons:
 
* [[wikipedia:WWW|Web]] [[wikipedia:Web browser|browsers]] can use the information in such [[wikipedia:Category:Wikipedia multilingual support templates|multilingual support templates]] to choose an appropriate font.
** This is great for [[wikipedia:CJK characters|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 {{section link|wikipedia:Han unification|Examples of language-dependent glyphs}} and [[wikipedia:User:Wikipeditor/CJK|these comparison tables with a screenshot]].
* For [[wikipedia:web accessibility|accessibility]] – [[wikipedia:screen reader|screen reader]]s need language info to speak text in the correct language – and to satisfy [[Wikipedia:Accessibility#Text|Wikipedia accessibility guidelines]].<ref>{{cite web|url=https://developer.yahoo.com/blogs/ydn/yahoo-search-results-now-natural-language-support-7318.html|title=Yahoo! search results now with natural language support|date=13 Mar 2008|first= Chris |last= Heilmann|work=[[wikipedia:Yahoo! Developer Network|]] Blog|accessdate=28 Feb 2015|archiveurl=https://web.archive.org/web/20090125024422/http://developer.yahoo.net/blog/archives/2008/03/yahoo_search_re.html|archivedate=25 Jan 2009|url-status=dead}}</ref>
* For [[wikipedia:spell checker|spell checker]]s and grammar checkers, to match the text to the dictionary and syntax of the correct language.
* To help browsers choose appropriate [[wikipedia:quotation mark|quotation mark]]s,<ref name="qa-lang-why">{{cite web|url=http://www.w3.org/International/questions/qa-lang-why|title=Why use the language attribute?|date=18 November 2014|first= Richard |last= Ishida | publisher=World Wide Web Consortium | issue=Previously by Deborah Cawkwell, BBC World Service|accessdate=1 Mar 2015}}</ref> and make decisions about [[wikipedia:Hyphen|hyphenation]],<ref name="qa-lang-why"/> [[wikipedia:orthographic ligature|ligature]]s,<ref>{{cite web|url=http://www.w3.org/TR/css3-fonts/#font-variant-ligatures-prop|title=6.4 Ligatures: the font-variant-ligatures property|work=CSS Fonts Module Level 3 W3C Candidate Recommendation 3 October 2013}}</ref> and spacing.<ref name="qa-lang-why"/>
* Users can apply styles to languages in their [[wikipedia:style sheet (web development)|style sheet]]s (useful for editors).
* [[wikipedia:Web search engine|Search engine]]s can use this information when [[wikipedia:search engine indexing|indexing]] text.
* Facilitates better data-scraping, parsing and re-use.
* Useful for application developers who re-publish Wikipedia (also see {{section link|Wikipedia:Manual of Style/Accessibility|Other languages}}).
Line 128:
== Applying styles ==
 
Registered users can apply custom [[Wikipedia:Cascading Style Sheets|CSS]] styles to articles by placing style declarations in their user style sheet. The user style sheet can be created at [[Special:Mypage/common.css]]. For more information, see [[wikipedia:Help:User style|Help:User style]]. The following examples should work in most [[wikipedia:List of web browsers|modern browsers]], but not in [[wikipedia:Internet Explorer 8|Internet Explorer 8]] or earlier, which lack support for attribute selectors.
 
To apply a specific font to all text marked as Russian of any script or region:
Line 152:
If a font name contains characters besides basic Latin letters or hyphens, it is a good idea to enclose it in quotation marks because some such characters have special meanings (the most common case needing quotation marks is a multi-word font name with space characters). Quotation marks are also required for font families containing generic-family keywords ('inherit', 'serif', 'sans-serif', 'monospace', 'fantasy', and 'cursive'). See the [http://www.w3.org/TR/CSS21/fonts.html#font-family-prop W3C] for more details.
 
You can combine this with font imports in your user stylesheet, for example, to show all German text in [[wikipedia:Fraktur|Fraktur]] and all Urdu in [[wikipedia:Noto fonts|Noto]] [[wikipedia:Nastaʿlīq script|Nastaliq]] Urdu Regular:
 
<syntaxhighlight lang="css">
Line 181:
{{lang|ur|ٹھنڈ میں، ایک قحط زدہ گاؤں سے گزرتے وقت ایک چڑچڑے، بااثر و فارغ شخص کو بعض جل پری نما اژدہے نظر آئے۔}}
</pre>
 
{{Wide image|Pangrams in DE and UR in Arial, UnifrakturMaguntia and Noto Nastaliq Urdu.png|1000px}}
 
== Tracking categories ==
* {{Category link with count|Lang and lang-xx template errors}}
* {{Category link with count|Lang and lang-xx code promoted to ISO 639-1}}
 
== TemplateData ==