Template:Date/doc: Difference between revisions
Template page
More actions
microformat class |
Prefix language interwiki links with w: |
||
| (48 intermediate revisions by 18 users not shown) | |||
| Line 1: | Line 1: | ||
{{ | {{Lua|Module:DateI18n}} | ||
{{TemplateBox | |||
=== | |1 = 1 | ||
|1aliases=year | |||
|1label = year | |||
|1d-en = Year number | |||
|1d-td = year | |||
|1type = number | |||
|1stat = optional | |||
|2 = 2 | |||
|2aliases=month | |||
|2label = month | |||
|2d-en = Month number or name (in English) | |||
|2type = number | |||
|2stat = optional | |||
=== | |3 = 3 | ||
|3aliases=day | |||
|3label = day | |||
|3d-en = Day number | |||
|3type = number | |||
|3stat = optional | |||
|4 = hour | |||
|4label = hour | |||
|4d-en = Hour number in 0-23 range | |||
|4type = number | |||
|4stat = optional | |||
=== | |5 = minute | ||
|5label = minute | |||
|5d-en = Minutes number in 0-59 range | |||
|5type = number | |||
|5stat = optional | |||
|6 = second | |||
{{ | |6label = second | ||
|6d-en = Seconds number in 0-59 range | |||
|6type = number | |||
|6stat = optional | |||
|14 = 4 | |||
|14aliases=lang | |||
|14label = language | |||
|14d-en = Language code (overrides user's preferences) | |||
|14type = string/line | |||
|14def = language code of the user language | |||
|14stat = optional- | |||
|15=case | |||
|15alias=form | |||
|15label = case | |||
|15d-en=By default each language uses preferred form of the date, which typically has month in [[:w:Nominative case|nominative]] or [[:w:Genitive case|genitive]] [[:w:Grammatical case|grammatical case]]. With ''case'' parameter one can overwrite the preferred case with some other one used by a given language. Parser function {{#time}} stores [[:w:Nominative case|nominative]] and [[:w:Genitive case|genitive]] forms, others are stored in [[Data:I18n/MonthCases.tab]]. This functionality is mostly used by [[Module:Complex date]]. Possible cases: | |||
*leave blank for default case, which is usually [[:w:Nominative case|nominative]] or [[:w:Genitive case|genitive case]] | |||
*"case=nom" for [[:w:Nominative case|nominative case]] | |||
*"case=gen" for [[:w:Genitive case|genitive case]] | |||
*"case=loc" for [[:w:Locative case|locative case]] (supported for pl, cs, sk & sl languages) | |||
*"case=ins" for [[:w:Instrumental case|instrumental case]] (supported for ru, pl, cs, sk & sl languages) | |||
Also [[:w:Partitive case|Partitive]] (ptv), [[:w:Inessive case|Inessive]] (ine), [[:w:Elative case|Elative]] (ela) and [[:w:Illative case|Illative]] (ill) cases are supported for Finnish language, in addition to [[:w:Nominative case|Nominative]] and [[:w:Genitive case|Genitive]] (gen). | |||
|15d-td-en= Allows to specify grammatical case for the month for languages that use them. | |||
|15stat = optional- | |||
|16=class | |||
|16label = class | |||
|16d-en = Allows setting of the HTML class of the time node where the date is included. This is useful for microformats. The default value is, for legacy reasons, "dtstart" (used by [[w:HCalendar|hCalendar]]). See [[Commons:Microformats Project|the microformats project]]. "class=-" will remove all metadata. | |||
|16d-td-en=Allows to set the HTML class of the time node where the date is included. This is useful for microformats. The default value is, for legacy reasons, "dtstart" (used by hCalendar). "class=-" will remove all metadata. | |||
|16def = dtstart | |||
|16stat = optional- | |||
|17=trim_year | |||
|17aliases= trim year | |||
|17label = trim year | |||
|17d-en = Should years smaller than 1000 be padded with zeros to the length of 4 digits or trimmed. Options: | |||
*1, yes, true - for always trimming | |||
*0, no, false - for always padding | |||
*''xx-yy'' - where xx is a minimum trimmed year and yy is the maximum trimmed year, for conditional trimming which depends on the year range. | |||
|17d-td-en=Should years smaller than 1000 be padded with zeros to the length of 4 digits or trimmed. Options: 1, yes, true: for always trimming; 0, no, false: for always padding; xx-yy - where xx is a minimum trimmed year and yy is the maximum trimmed year, for conditional trimming which depends on the year range. | |||
|17def = 100-999 | |||
|17stat = optional- | |||
|name=Date | |||
|desc=This template is used to show a date in the language set in the preferences. | |||
You can leave out parts of the data. | |||
|namespace=Template | |||
|usergroup=all | |||
|usage-notes= | |||
Examples: | |||
*{{xpdoc|date|2009|1|9}} | |||
*{{xpdoc|date|2009|1}} | |||
*{{xpdoc|date|2009}} | |||
Generating output in Polish: | |||
*{{xpdoc|date|2009|1|9|pl}} | |||
*{{xpdoc|date|2009|1|9|pl|n1=case|v1=}} - alternative way to get nominative case | |||
*{{xpdoc|date|2009|1|9|pl|n1=case|v1=gen}} | |||
*{{xpdoc|date|2009|1|9|pl|n1=case|v1=ins}} | |||
*{{xpdoc|date|2009|1||pl}} | |||
*{{xpdoc|date|2009|1||pl|n1=form|v1=gen}} | |||
*{{xpdoc|date|2009|1||pl|n1=form|v1=ins}} | |||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=yes}} | |||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=no}} | |||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=100-999}} | |||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=100-500}} | |||
=== Microformat === | === Microformat === | ||
The template returns the date, embed in a <nowiki><time></nowiki> element with attribute datetime that contain the date in the ISO 8601 format needed by the <!-- hAtom (class="updated"),--> [[w:HCalendar|hCalendar]] (<code>class="dtstart"</code>) <!-- and hCard (class="bday")--> microformat. See [[Commons:Microformats Project|the microformats project]]. | |||
|type=marker | |||
|example= | |||
|i18n-method= | |||
|i18n-desc=Localize the date format at [[Module:I18n/date]] or request assistance at [[Template talk:Date]] or [[Module talk:I18n/date]] | |||
|seealso={{tl|ISOdate}} – Template used to parse the date in {{tl|information}}<br /> {{tl|other date}} – Allows to specify a range of non-trivial date notations in a format that is localizable<br /> {{tl|odate}} – Allows to specify two dates, of original and of vectorization | |||
|setscats= | |||
|lines=one | |||
|shorthand= | |||
|relieson=[[Module:DateI18n]] | |||
|useTemplateData = 1 | |||
}}<includeonly> | |||
[[Category:Time, date and calendar templates]] | |||
[[Category:User interface language dependent templates]] | |||
[[Category:Lua-based templates]] | |||
</includeonly> | |||