Skip to content

Commit

Permalink
Merge "Document available wbformatvalue options"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Nov 5, 2024
2 parents 5ee85b3 + e0df93d commit abfd924
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion repo/i18n/api/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"apihelp-wbformatvalue-param-generate": "The desired output format to generate.",
"apihelp-wbformatvalue-param-datatype": "The value's data type. This is distinct from the value's type",
"apihelp-wbformatvalue-param-datavalue": "The data to format. This has to be the JSON serialization of a DataValue object.",
"apihelp-wbformatvalue-param-options": "The options the formatter should use. Provided as a JSON object.",
"apihelp-wbformatvalue-param-options": "The options the formatter should use. Provided as a JSON object.\n\nThe supported options are:\n; $1: The language in which the value should be formatted (a MediaWiki language code).\n; $2: Whether to apply rounding to the number. Can be a boolean (automatic / no rounding) or an integer (exponent of the last significant decimal digits). Only useful for quantity values.\n; $3: Whether to include the unit in the output (a boolean). Only useful for quantity values.\n; $4: Whether to show the calendar model. Can be a boolean (always / never show) or the string <code>\"auto\"</code> (automatically determine whether to show). Only useful for time values.",
"apihelp-wbformatvalue-param-property": "Property ID the data value belongs to, should be used instead of the <var>datatype</var> parameter.",
"apihelp-wbformatvalue-example-1": "Format a simple string value.",
"apihelp-wbformatvalue-example-2": "Format a string value as a URL in HTML.",
Expand Down
2 changes: 1 addition & 1 deletion repo/i18n/api/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"apihelp-wbformatvalue-param-generate": "{{doc-apihelp-param|wbformatvalue|generate}}",
"apihelp-wbformatvalue-param-datatype": "{{doc-apihelp-param|wbformatvalue|datatype}}",
"apihelp-wbformatvalue-param-datavalue": "{{doc-apihelp-param|wbformatvalue|datavalue}}",
"apihelp-wbformatvalue-param-options": "{{doc-apihelp-param|wbformatvalue|options}}",
"apihelp-wbformatvalue-param-options": "{{doc-apihelp-param|wbformatvalue|options|params=* $1, $2, $3, $4 - The names of the four supported options|paramstart=5}}",
"apihelp-wbformatvalue-param-property": "{{doc-apihelp-param|wbformatvalue|property}}",
"apihelp-wbformatvalue-example-1": "{{doc-apihelp-example|wbformatvalue}}",
"apihelp-wbformatvalue-example-2": "{{doc-apihelp-example|wbformatvalue}}",
Expand Down
7 changes: 7 additions & 0 deletions repo/includes/Api/FormatSnakValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ protected function getAllowedParams(): array {
'options' => [
ParamValidator::PARAM_TYPE => 'text',
ParamValidator::PARAM_REQUIRED => false,
ApiBase::PARAM_HELP_MSG => [
'apihelp-wbformatvalue-param-options',
ValueFormatter::OPT_LANG,
QuantityFormatter::OPT_APPLY_ROUNDING,
QuantityFormatter::OPT_APPLY_UNIT,
ShowCalendarModelDecider::OPT_SHOW_CALENDAR,
],
],
];
}
Expand Down

0 comments on commit abfd924

Please sign in to comment.