From 65b101e60c5dad8342f3190f9a8fac491a5f4b49 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 28 Apr 2015 16:48:11 +0100 Subject: [PATCH] Add example property to HTML rendering Follows-up ec0467c65a. Bug: T53049 Change-Id: I07dd73b7e2ba0994f29e1b9e619c5cbf347d4d9d --- TemplateDataBlob.php | 20 ++++++++++++++++++++ i18n/en.json | 2 ++ i18n/qqq.json | 2 ++ 3 files changed, 24 insertions(+) diff --git a/TemplateDataBlob.php b/TemplateDataBlob.php index a82be9eb..a443463e 100644 --- a/TemplateDataBlob.php +++ b/TemplateDataBlob.php @@ -617,6 +617,11 @@ class TemplateDataBlob { if ( $paramObj->default !== null ) { $paramObj->default = self::getInterfaceTextInLanguage( $paramObj->default, $langCode ); } + + // Param.example + if ( $paramObj->example !== null ) { + $paramObj->example = self::getInterfaceTextInLanguage( $paramObj->example, $langCode ); + } } foreach ( $data->sets as $setObj ) { @@ -694,6 +699,11 @@ class TemplateDataBlob { array(), wfMessage( 'templatedata-doc-param-default' )->inLanguage( $lang )->text() ) + . Html::element( + 'th', + array(), + wfMessage( 'templatedata-doc-param-example' )->inLanguage( $lang )->text() + ) . Html::element( 'th', array(), @@ -783,6 +793,16 @@ class TemplateDataBlob { $paramObj->default : wfMessage( 'templatedata-doc-param-default-empty' )->inLanguage( $lang )->text() ) + // Example + . Html::element( 'td', array( + 'class' => array( + 'mw-templatedata-doc-muted' => $paramObj->example === null + ) + ), + $paramObj->example !== null ? + $paramObj->example : + wfMessage( 'templatedata-doc-param-example-empty' )->inLanguage( $lang )->text() + ) // Auto value . Html::rawElement( 'td', array( 'class' => array( diff --git a/i18n/en.json b/i18n/en.json index c09a6808..a42b2f4d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -18,6 +18,8 @@ "templatedata-doc-param-autovalue-empty": "empty", "templatedata-doc-param-default": "Default", "templatedata-doc-param-default-empty": "empty", + "templatedata-doc-param-example": "Example", + "templatedata-doc-param-example-empty": "empty", "templatedata-doc-param-desc": "Description", "templatedata-doc-param-desc-empty": "no description", "templatedata-doc-param-name": "Parameter", diff --git a/i18n/qqq.json b/i18n/qqq.json index e8ba015c..c05a5c76 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -25,6 +25,8 @@ "templatedata-doc-param-autovalue-empty": "Displayed when a template parameter has no auto filled value (should not be a full sentence, used in a table).\n{{Identical|Empty}}", "templatedata-doc-param-default": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Default}}", "templatedata-doc-param-default-empty": "Displayed when a template parameter has no default value (should not be a full sentence, used in a table).\n{{Identical|Empty}}", + "templatedata-doc-param-example": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Example}}", + "templatedata-doc-param-example-empty": "Displayed when a template parameter has no example value (should be short, used in a table).\n{{Identical|Empty}}", "templatedata-doc-param-desc": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Description}}", "templatedata-doc-param-desc-empty": "Displayed when a template parameter has no description (should not be a full sentence, used in a table cell).\n{{Identical|No description}}", "templatedata-doc-param-name": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Parameter}}",