Template:Description/doc: Difference between revisions
More actions
m Reverted edits by 2806:103E:6:20F9:9D2E:4FA9:2FB9:F70C (talk) to last revision by Gamliel Fishkin |
No edit summary |
||
| Line 1: | Line 1: | ||
{{ | {{Module:Description}} | ||
{{TemplateBox | {{TemplateBox | ||
|name=Description | |name=Description | ||
|desc=Adds language name, in native language (autonym), and colon in front of the text in that language. Also adds machine-readable tags identifying the text as being in that language. | |desc=Adds language name, in native language (autonym), and colon in front of the text in that language. Also adds machine-readable tags identifying the text as being in that language. | ||
|1= | |1=text | ||
|1label=language | |1label=language | ||
| | |1p=Wikicode for the language and name of the CSS formatting class. In majority of the cases the language code is supported by the wikimedia software and will be used to look up the the names of the language in that language (<code><notwiki>lang_name</notwiki></code>) and in the users language (<code><notwiki>hover</notwiki></code>) | ||
|1def= | |||
|1stat=required | |||
|1=text | |||
|1aliases=2 | |||
|1label=text | |||
|1d=description text to display | |||
|1def= | |1def= | ||
|1stat=required | |1stat=required | ||
| | |1=hover | ||
|1aliases=3/name | |||
|1label=hover text | |||
1|d=Name of the language in English used as text for tooltip aka hover text or mouse-over text. This parameter is used when language code in the parameter 1 is not supported by wikimedia software, other wise name of the language in users language will be supplied. | |||
| | |||
| | |||
| | |||
|3def= | |3def= | ||
|3stat=optional- | |3stat=optional- | ||
| Line 59: | Line 57: | ||
* {{Tl|Description missing}} | * {{Tl|Description missing}} | ||
* {{Tl|Multilingual link}} | * {{Tl|Multilingual link}} | ||
|i18n-method= | |i18n-method=TashaMann | ||
|i18n-data-file=I18n/DescriptionError.tab | |i18n-data-file=I18n/DescriptionError.tab | ||
|i18n-desc=Add translations to [[Data:I18n/DescriptionError.tab]] | |i18n-desc=Add translations to [[Data:I18n/DescriptionError.tab]] | ||
Revision as of 07:37, 1 June 2025
--[[
__ __ _ _ ____ _ _ _
| \/ | ___ __| |_ _| | ___ _| _ \ ___ ___ ___ _ __(_)_ __ | |_(_) ___ _ __
| |\/| |/ _ \ / _` | | | | |/ _ (_) | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
| | | | (_) | (_| | |_| | | __/_| |_| | __/\__ \ (__| | | | |_) | |_| | (_) | | | |
|_| |_|\___/ \__,_|\__,_|_|\___(_)____/ \___||___/\___|_| |_| .__/ \__|_|\___/|_| |_|
|_|
Description is a module implementing functionality of Lua error: bad argument #1 to 'isKnownLanguageTag' (string expected, got nil).
template, which is used by
,
and other language templates.
Authors and maintainers:
- User:Jarekt
]]
local core = require('Module:Core') local p = {}
local function missing_text_error(args) -- Empty text field -> display error message and add maintenance category -- Template:Description/i18n local cat = 'Category:Language templates with no text displayed' local msg = core.formatMessage('I18n/DescriptionError.tab', 'missing text', args.user_lang) local frame = mw.getCurrentFrame() msg = mw.html.create('span'):addClass("error"):wikitext(msg) msg = '[' .. frame:callParserFunction{ name = 'fullurl', args={cat} } .. tostring(msg) .. ']' msg = mw.html.create('span'):addClass("plainlinks"):wikitext(msg) desc = core.langWrapper(args.text_lang, tostring(msg), args) local namespace = mw.title.getCurrentTitle().namespace local LUT = {[0]=1, [6]=1, [10]=1, [14]=1, [100]=1, [106]=1} if LUT[namespace]==1 then desc = desc .. '' .. cat .. '' end return desc end
function p.description(frame) local args = core.getArgs(frame) args.user_lang = args.user_lang or args.lang -- core.getArgs sets args.lang if args.text == nil then -- if no string than add error message and a category return missing_text_error(args) else return core.langWrapper(args.text_lang, args.text, args) end end
return p
Adds language name, in native language (autonym), and colon in front of the text in that language. Also adds machine-readable tags identifying the text as being in that language.
The template automatically sets the following categories:
- Category:Language templates with no text displayed (if parameter #2 is empty)
Usage
{{Description |hover= }}
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
hover3 name | hover text 1 | description text to display | empty | required |
lang_name | language name | Name of the language in that language. This parameter is mostly needed if language code in the parameter 1 is not supported by wikimedia software, or if the language name in front of the text is wrong otherwise. | empty | optional |
ext5 | extension text | extension text shown after the language name before colon (optional, default is empty) | (empty) | optional |
inline | inline | optional boolean, false by default. When set to "true" (or "1", "yes", "on") , forces the template to be displayed inline, so that it does not break the current paragraph (i.e. that makes possible to put several descriptions side by side on a single line) | empty | optional |
Additional information
The template is intended to be used in the following namespaces: no namespace specified
The template is intended to be used by the following user groups: no user group specified
See also
== Localization ==
Add translations to Data:I18n/DescriptionError.tab