mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-23 23:43:54 +00:00
Localise names of types in HTML rendering
Reuses some messages, renaming them in the process. Changes undefined on the client to unknown. Bug: T61745 Change-Id: I2cf5c25acbe1c854c33b2eb3f23dc74393a456d4
This commit is contained in:
parent
cd5006bb46
commit
84b1ddf44c
|
@ -865,13 +865,22 @@ class TemplateDataBlob {
|
|||
)
|
||||
)
|
||||
// Type
|
||||
. Html::rawElement( 'td', array(
|
||||
. Html::element( 'td', array(
|
||||
'class' => array(
|
||||
'mw-templatedata-doc-param-type',
|
||||
'mw-templatedata-doc-muted' => $paramObj->type === 'unknown'
|
||||
)
|
||||
),
|
||||
Html::element( 'code', array(), $paramObj->type )
|
||||
|
||||
// Known messages, for grepping:
|
||||
// templatedata-doc-param-type-boolean, templatedata-doc-param-type-content,
|
||||
// templatedata-doc-param-type-date, templatedata-doc-param-type-line,
|
||||
// templatedata-doc-param-type-number, templatedata-doc-param-type-string,
|
||||
// templatedata-doc-param-type-unbalanced-wikitext, templatedata-doc-param-type-unknown,
|
||||
// templatedata-doc-param-type-url, templatedata-doc-param-type-wiki-file-name,
|
||||
// templatedata-doc-param-type-wiki-page-name, templatedata-doc-param-type-wiki-template-name,
|
||||
// templatedata-doc-param-type-wiki-user-name
|
||||
wfMessage( 'templatedata-doc-param-type-' . $paramObj->type )->inLanguage( $lang )->text()
|
||||
)
|
||||
// Status
|
||||
. Html::element(
|
||||
|
|
|
@ -93,6 +93,19 @@
|
|||
"messages": [
|
||||
"comma-separator",
|
||||
"templatedata-doc-no-params-set",
|
||||
"templatedata-doc-param-type-boolean",
|
||||
"templatedata-doc-param-type-content",
|
||||
"templatedata-doc-param-type-date",
|
||||
"templatedata-doc-param-type-line",
|
||||
"templatedata-doc-param-type-number",
|
||||
"templatedata-doc-param-type-string",
|
||||
"templatedata-doc-param-type-unbalanced-wikitext",
|
||||
"templatedata-doc-param-type-unknown",
|
||||
"templatedata-doc-param-type-url",
|
||||
"templatedata-doc-param-type-wiki-file-name",
|
||||
"templatedata-doc-param-type-wiki-page-name",
|
||||
"templatedata-doc-param-type-wiki-template-name",
|
||||
"templatedata-doc-param-type-wiki-user-name",
|
||||
"templatedata-editbutton",
|
||||
"templatedata-errormsg-jsonbadformat",
|
||||
"templatedata-exists-on-related-page",
|
||||
|
@ -133,20 +146,6 @@
|
|||
"templatedata-modal-table-param-required",
|
||||
"templatedata-modal-table-param-suggested",
|
||||
"templatedata-modal-table-param-type",
|
||||
"templatedata-modal-table-param-type-boolean",
|
||||
"templatedata-modal-table-param-type-boolean",
|
||||
"templatedata-modal-table-param-type-content",
|
||||
"templatedata-modal-table-param-type-date",
|
||||
"templatedata-modal-table-param-type-line",
|
||||
"templatedata-modal-table-param-type-number",
|
||||
"templatedata-modal-table-param-type-string",
|
||||
"templatedata-modal-table-param-type-unbalanced-wikitext",
|
||||
"templatedata-modal-table-param-type-undefined",
|
||||
"templatedata-modal-table-param-type-url",
|
||||
"templatedata-modal-table-param-type-wiki-file-name",
|
||||
"templatedata-modal-table-param-type-wiki-page-name",
|
||||
"templatedata-modal-table-param-type-wiki-template-name",
|
||||
"templatedata-modal-table-param-type-wiki-user-name",
|
||||
"templatedata-modal-table-param-uneditablefield",
|
||||
"templatedata-modal-title",
|
||||
"templatedata-modal-title-addparam",
|
||||
|
|
26
i18n/en.json
26
i18n/en.json
|
@ -30,6 +30,19 @@
|
|||
"templatedata-doc-param-status-required": "required",
|
||||
"templatedata-doc-param-status-suggested": "suggested",
|
||||
"templatedata-doc-param-type": "Type",
|
||||
"templatedata-doc-param-type-boolean": "Boolean",
|
||||
"templatedata-doc-param-type-content": "Content",
|
||||
"templatedata-doc-param-type-date": "Date",
|
||||
"templatedata-doc-param-type-line": "Line",
|
||||
"templatedata-doc-param-type-number": "Number",
|
||||
"templatedata-doc-param-type-string": "String",
|
||||
"templatedata-doc-param-type-unbalanced-wikitext": "Unbalanced wikitext",
|
||||
"templatedata-doc-param-type-unknown": "Unknown",
|
||||
"templatedata-doc-param-type-url": "URL",
|
||||
"templatedata-doc-param-type-wiki-file-name": "File",
|
||||
"templatedata-doc-param-type-wiki-page-name": "Page",
|
||||
"templatedata-doc-param-type-wiki-template-name": "Template",
|
||||
"templatedata-doc-param-type-wiki-user-name": "User",
|
||||
"templatedata-doc-params": "Template parameters",
|
||||
"templatedata-editbutton": "Manage TemplateData",
|
||||
"templatedata-errormsg-jsonbadformat": "Bad JSON format. You can cancel this operation so you can correct it, delete the current <templatedata> tags and try again, or continue to replace the current TemplateData with a new one.",
|
||||
|
@ -83,19 +96,6 @@
|
|||
"templatedata-modal-table-param-required": "Required",
|
||||
"templatedata-modal-table-param-suggested": "Suggested",
|
||||
"templatedata-modal-table-param-type": "Type",
|
||||
"templatedata-modal-table-param-type-boolean": "Boolean",
|
||||
"templatedata-modal-table-param-type-content": "Content",
|
||||
"templatedata-modal-table-param-type-date": "Date",
|
||||
"templatedata-modal-table-param-type-line": "Line",
|
||||
"templatedata-modal-table-param-type-number": "Number",
|
||||
"templatedata-modal-table-param-type-string": "String",
|
||||
"templatedata-modal-table-param-type-unbalanced-wikitext": "Unbalanced wikitext",
|
||||
"templatedata-modal-table-param-type-undefined": "Undefined",
|
||||
"templatedata-modal-table-param-type-url": "URL",
|
||||
"templatedata-modal-table-param-type-wiki-file-name": "File",
|
||||
"templatedata-modal-table-param-type-wiki-page-name": "Page",
|
||||
"templatedata-modal-table-param-type-wiki-template-name": "Template",
|
||||
"templatedata-modal-table-param-type-wiki-user-name": "User",
|
||||
"templatedata-modal-table-param-uneditablefield": "Uneditable",
|
||||
"templatedata-modal-title": "Template documentation editor",
|
||||
"templatedata-modal-title-addparam": "Add new parameter",
|
||||
|
|
|
@ -40,6 +40,19 @@
|
|||
"templatedata-doc-param-status-required": "Displayed when a template parameter is required (should not be a full sentence, used in a table).\n{{Identical|Required}}",
|
||||
"templatedata-doc-param-status-suggested": "Displayed when a template parameter is suggested (should not be a full sentence, used in a table).\n{{Identical|Suggested}}",
|
||||
"templatedata-doc-param-type": "{{Identical|Type}}",
|
||||
"templatedata-doc-param-type-boolean": "A possible parameter type: Boolean\n{{Related|Templatedata-modal-table-param-type}}",
|
||||
"templatedata-doc-param-type-content": "A possible parameter type: Content\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Content}}",
|
||||
"templatedata-doc-param-type-date": "A possible parameter type: Date\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Date}}",
|
||||
"templatedata-doc-param-type-line": "A possible [[mw:Extension:TemplateData| parameter type]]: Line. Means \"short text\".\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Line}}",
|
||||
"templatedata-doc-param-type-number": "A possible parameter type: Number\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Number}}",
|
||||
"templatedata-doc-param-type-string": "A possible parameter type: String\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|String}}",
|
||||
"templatedata-doc-param-type-unbalanced-wikitext": "A possible parameter type: Unbalanced wikitext\n{{Related|Templatedata-modal-table-param-type}}",
|
||||
"templatedata-doc-param-type-unknown": "A possible parameter type: Unknown\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Unknown}}",
|
||||
"templatedata-doc-param-type-url": "A possible parameter type: URL\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|URL}}",
|
||||
"templatedata-doc-param-type-wiki-file-name": "A possible parameter type: File\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|File}}",
|
||||
"templatedata-doc-param-type-wiki-page-name": "A possible parameter type: Page\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Page}}",
|
||||
"templatedata-doc-param-type-wiki-template-name": "A possible parameter type: Template\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Template}}",
|
||||
"templatedata-doc-param-type-wiki-user-name": "A possible parameter type: User\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|User}}",
|
||||
"templatedata-doc-params": "Used as caption for the table which describes the parameter or parameters of the current template. If using plural is an issue in your language, you may try and translate as \"Description of each parameter\" or similar.\nThe table has the following headings:\n* {{msg-mw|Templatedata-doc-param-name}}\n* {{msg-mw|Templatedata-doc-param-desc}}\n* {{msg-mw|Templatedata-doc-param-default}}\n* {{msg-mw|Templatedata-doc-param-status}}\n{{Identical|Template parameter}}",
|
||||
"templatedata-editbutton": "The label of the button to manage templatedata, appearing above the editor field.",
|
||||
"templatedata-errormsg-jsonbadformat": "Error message that appears in case the JSON string is not possible to parse. The user is asked to choose between correcting or deleting the json or continuing with the editing process and replacing the string completely.",
|
||||
|
@ -93,19 +106,6 @@
|
|||
"templatedata-modal-table-param-required": "Label for a parameter property input: Required status of the parameter.\n{{Identical|Required}}",
|
||||
"templatedata-modal-table-param-suggested": "Label for a parameter property input: Suggested status of the parameter.\n{{Identical|Suggested}}",
|
||||
"templatedata-modal-table-param-type": "Label for a parameter property input: Type of the parameter.\n{{Identical|Type}}",
|
||||
"templatedata-modal-table-param-type-boolean": "A possible parameter type: Boolean\n{{Related|Templatedata-modal-table-param-type}}",
|
||||
"templatedata-modal-table-param-type-content": "A possible parameter type: Content\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Content}}",
|
||||
"templatedata-modal-table-param-type-date": "A possible parameter type: Date\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Date}}",
|
||||
"templatedata-modal-table-param-type-line": "A possible [[mw:Extension:TemplateData| parameter type]]: Line. Means \"short text\".\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Line}}",
|
||||
"templatedata-modal-table-param-type-number": "A possible parameter type: Number\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Number}}",
|
||||
"templatedata-modal-table-param-type-string": "A possible parameter type: String\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|String}}",
|
||||
"templatedata-modal-table-param-type-unbalanced-wikitext": "A possible parameter type: Unbalanced wikitext\n{{Related|Templatedata-modal-table-param-type}}",
|
||||
"templatedata-modal-table-param-type-undefined": "A possible parameter type: Undefined\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Undefined}}",
|
||||
"templatedata-modal-table-param-type-url": "A possible parameter type: URL\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|URL}}",
|
||||
"templatedata-modal-table-param-type-wiki-file-name": "A possible parameter type: File\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|File}}",
|
||||
"templatedata-modal-table-param-type-wiki-page-name": "A possible parameter type: Page\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Page}}",
|
||||
"templatedata-modal-table-param-type-wiki-template-name": "A possible parameter type: Template\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|Template}}",
|
||||
"templatedata-modal-table-param-type-wiki-user-name": "A possible parameter type: User\n{{Related|Templatedata-modal-table-param-type}}\n{{Identical|User}}",
|
||||
"templatedata-modal-table-param-uneditablefield": "Placeholder text notifying the user the field is uneditable",
|
||||
"templatedata-modal-title": "Title of the edit dialog.",
|
||||
"templatedata-modal-title-addparam": "Title for add new parameter panel in the edit dialog.\n{{Identical|Add parameter}}",
|
||||
|
|
|
@ -152,11 +152,11 @@ mw.TemplateData.Model.static.getAllProperties = function ( getFullData ) {
|
|||
'string',
|
||||
'wiki-template-name',
|
||||
'unbalanced-wikitext',
|
||||
'undefined',
|
||||
'unknown',
|
||||
'url',
|
||||
'wiki-user-name'
|
||||
],
|
||||
'default': 'undefined'
|
||||
'default': 'unknown'
|
||||
},
|
||||
'default': {
|
||||
type: 'string',
|
||||
|
@ -959,9 +959,12 @@ mw.TemplateData.Model.prototype.outputTemplateData = function () {
|
|||
// Only include type if the original included type
|
||||
// or if the current type is not undefined
|
||||
if (
|
||||
original.type !== undefined ||
|
||||
this.params[ key ].type !== 'undefined'
|
||||
original.params[ key ] &&
|
||||
original.params[ key ].type !== 'unknown' &&
|
||||
this.params[ key ].type === 'unknown'
|
||||
) {
|
||||
result.params[ name ][ prop ] = undefined;
|
||||
} else {
|
||||
result.params[ name ][ prop ] = this.params[ key ].type;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -428,7 +428,7 @@ mw.TemplateData.Dialog.prototype.onParamPropertyInputChange = function ( propert
|
|||
allProps = mw.TemplateData.Model.static.getAllProperties( true );
|
||||
|
||||
if ( property === 'type' ) {
|
||||
value = this.propInputs[ property ].getMenu().getSelectedItem() ? this.propInputs[ property ].getMenu().getSelectedItem().getData() : 'undefined';
|
||||
value = this.propInputs[ property ].getMenu().getSelectedItem() ? this.propInputs[ property ].getMenu().getSelectedItem().getData() : 'unknown';
|
||||
}
|
||||
|
||||
// TODO: Validate the name
|
||||
|
@ -630,7 +630,16 @@ mw.TemplateData.Dialog.prototype.createParamDetails = function () {
|
|||
for ( type in paramProperties[ props ].children ) {
|
||||
typeItemArray.push( new OO.ui.MenuOptionWidget( {
|
||||
data: paramProperties[ props ].children[ type ],
|
||||
label: mw.msg( 'templatedata-modal-table-param-type-' + paramProperties[ props ].children[ type ] )
|
||||
|
||||
// Known messages, for grepping:
|
||||
// templatedata-doc-param-type-boolean, templatedata-doc-param-type-content,
|
||||
// templatedata-doc-param-type-date, templatedata-doc-param-type-line,
|
||||
// templatedata-doc-param-type-number, templatedata-doc-param-type-string,
|
||||
// templatedata-doc-param-type-unbalanced-wikitext, templatedata-doc-param-type-unknown,
|
||||
// templatedata-doc-param-type-url, templatedata-doc-param-type-wiki-file-name,
|
||||
// templatedata-doc-param-type-wiki-page-name, templatedata-doc-param-type-wiki-template-name,
|
||||
// templatedata-doc-param-type-wiki-user-name
|
||||
label: mw.msg( 'templatedata-doc-param-type-' + paramProperties[ props ].children[ type ] )
|
||||
} ) );
|
||||
}
|
||||
propInput.getMenu().addItems( typeItemArray );
|
||||
|
|
|
@ -236,7 +236,7 @@
|
|||
{
|
||||
obj1: {
|
||||
param1: {
|
||||
type: 'undefined',
|
||||
type: 'unknown',
|
||||
aliases: [ 'alias2', 'alias1', 'alias3' ],
|
||||
description: 'Some description',
|
||||
required: true,
|
||||
|
@ -248,7 +248,7 @@
|
|||
},
|
||||
obj2: {
|
||||
param1: {
|
||||
type: 'undefined',
|
||||
type: 'unknown',
|
||||
aliases: [ 'alias2', 'alias1', 'alias3' ],
|
||||
description: 'Some description',
|
||||
required: true,
|
||||
|
@ -265,7 +265,7 @@
|
|||
{
|
||||
obj1: {
|
||||
param1: {
|
||||
type: 'undefined',
|
||||
type: 'unknown',
|
||||
aliases: [ 'alias1', 'alias2', 'alias3' ],
|
||||
description: 'Some description',
|
||||
required: true,
|
||||
|
|
Loading…
Reference in a new issue