Template:Date/doc: Difference between revisions
From Test Wiki
Content deleted Content added
No edit summary |
+pt-br |
||
| Line 1: | Line 1: | ||
{{Documentation subpage}} |
|||
{{Lua|Module:DateI18n}} |
|||
{{TemplateBox |
|||
Gives a date in the language with a specified code (the default for that code is the result of [[Template:Uselang]], which is <code>{{uselang}}</code>). |
|||
|1 = 1 |
|||
|1aliases=year |
|||
|1label = year |
|||
|1d-en = Year number |
|||
|1d-td = year |
|||
|1type = number |
|||
|1stat = optional |
|||
Note that this translated date may have a lowercase initial (unless its first term is always capitalized, like month names in English), so that it can be used in the middle of a sentence. At start of a sentence or paragraph (but not at start of an item in an enumerated list that is part of a larger sentence), you may need to embed the template transclusion in a <code><nowiki>{{UCFIRST: }}</nowiki></code> parser call. |
|||
|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 [[:en:Nominative case|nominative]] or [[:en:Genitive case|genitive]] [[:en: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 [[:en:Nominative case|nominative]] and [[:en: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 [[:en:Nominative case|nominative]] or [[:en:Genitive case|genitive case]] |
|||
*"case=nom" for [[:en:Nominative case|nominative case]] |
|||
*"case=gen" for [[:en:Genitive case|genitive case]] |
|||
*"case=loc" for [[:en:Locative case|locative case]] (supported for pl, cs, sk & sl languages) |
|||
*"case=ins" for [[:en:Instrumental case|instrumental case]] (supported for ru, pl, cs, sk & sl languages) |
|||
Also [[:en:Partitive case|Partitive]] (ptv), [[:en:Inessive case|Inessive]] (ine), [[:en:Elative case|Elative]] (ela) and [[:en:Illative case|Illative]] (ill) cases are supported for Finnish language, in addition to [[:en:Nominative case|Nominative]] and [[:en: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- |
|||
{{Tdoc |
|||
|1=1 |
|||
|1d=number of the year |
|||
|2=2 |
|||
|2d=number of month in the year |
|||
|3=3 |
|||
|3d=number of day in the month |
|||
|4=lang<br /> 4 |
|||
|4d=language code |
|||
|4def=language code of the user language |
|||
|5=form |
|||
|5d=allows to specify differing syntactic forms to apply to the date (e.g. in some Polish phrases the month must appear in [[w:Genitive case|genitive form]] instead of nominative, so you have to set <tt>form</tt> to ''gen'') |
|||
|name=Date |
|name=Date |
||
|desc=You can leave out parts of the data. |
|||
|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 |
|namespace=Template |
||
|usergroup=all |
|usergroup=all |
||
|i18n-method=switch |
|||
|usage-notes= |
|||
|i18n-desc= |
|||
Examples: |
|||
|seealso= |
|||
*{{xpdoc|date|2009|1|9}} |
|||
* [[Template:DateT]] |
|||
*{{xpdoc|date|2009|1}} |
|||
* [[commons:Template:Date]] |
|||
*{{xpdoc|date|2009}} |
|||
|relieson=<nowiki/> |
|||
* [[Template:I18n month]] |
|||
Generating output in Polish: |
|||
* [[Template:Formatnum]] |
|||
*{{xpdoc|date|2009|1|9|pl}} |
|||
|examples=<nowiki/> |
|||
*{{xpdoc|date|2009|1|9|pl|n1=case|v1=}} - alternative way to get nominative case |
|||
*{{ |
* {{xpsoc|date|2009|1|9}} |
||
*{{ |
* {{xpsoc|date|1970|2|3}} |
||
*{{ |
* {{xpsoc|date|1970|2}} |
||
*{{ |
* {{xpsoc|date|1970}} |
||
*{{ |
* {{xpsoc|date||1|9}} |
||
* {{xpsoc|date||2|3}} |
|||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=yes}} |
|||
* {{xpsoc|date||2}} |
|||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=no}} |
|||
* {{xpsoc|date}} |
|||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=100-999}} |
|||
* {{xpsoc|date|1970|||zh}} |
|||
*{{xpdoc|date|n1=year|v1=888|n2=lang|v2=pl|n3=case|v3=ins|n4=trim_year|v4=100-500}} |
|||
Does not check existence, except for the month number: |
|||
* {{xpsoc|date|2009|12|33}} |
|||
=== Microformat === |
|||
* {{xpsoc|date|2009|17|33}} |
|||
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 |
|||
<includeonly> |
|||
|example= |
|||
[[Category:User interface language dependent templates|Date]] |
|||
|i18n-method= |
|||
[[Category:Date computing template|Date]] |
|||
|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> |
</includeonly> |
||
<templatedata> |
|||
{ |
|||
"params": { |
|||
"1": { |
|||
"label": { |
|||
"en": "Year", |
|||
"pt-br": "Ano" |
|||
} |
|||
}, |
|||
"2": { |
|||
"label": { |
|||
"en": "Month", |
|||
"pt-br": "Mês" |
|||
}, |
|||
"description": { |
|||
"en": "As a number", |
|||
"pt-br": "Como número" |
|||
}, |
|||
"example": "3", |
|||
"type": "number" |
|||
}, |
|||
"3": { |
|||
"label": { |
|||
"en": "Day", |
|||
"pt-br": "Dia" |
|||
}, |
|||
"description": { |
|||
"en": "Number of day in the month", |
|||
"pt-br": "Número do dia do mês" |
|||
} |
|||
}, |
|||
"4": {}, |
|||
"lang": { |
|||
"label": { |
|||
"en": "Language code", |
|||
"pt-br": "Código de idioma" |
|||
} |
|||
}, |
|||
"form": {} |
|||
} |
|||
} |
|||
</templatedata> |
|||