Merge "Fix use of formatnum in templatedata-invalid-length"

This commit is contained in:
jenkins-bot 2022-02-02 08:16:16 +00:00 committed by Gerrit Code Review
commit 4b3a7fa4e3
2 changed files with 7 additions and 2 deletions

View file

@ -50,7 +50,7 @@
"templatedata-invalid-duplicate-value": "Property \"$1\" (\"$3\") is a duplicate of \"$2\".",
"templatedata-invalid-empty-array": "Property \"$1\" must have at least one value in its array.",
"templatedata-invalid-format": "Property \"$1\" is expected to be \"inline\", \"block\", or a valid format string.",
"templatedata-invalid-length": "Data too large to save ({{formatnum:$1}} {{PLURAL:$1|byte|bytes}}, {{PLURAL:$2|limit is}} {{formatnum:$2}})",
"templatedata-invalid-length": "Data too large to save ($1 {{PLURAL:$1|byte|bytes}}, {{PLURAL:$2|limit is}} $2)",
"templatedata-invalid-missing": "Required property \"$1\" not found.",
"templatedata-invalid-param": "Invalid parameter \"$1\" for property \"$2\".",
"templatedata-invalid-parse": "Syntax error in JSON.",

View file

@ -6,6 +6,7 @@
namespace MediaWiki\Extension\TemplateData;
use Message;
use Status;
/**
@ -32,7 +33,11 @@ class TemplateDataCompressedBlob extends TemplateDataBlob {
if ( $status->isOK() ) {
$length = strlen( $this->getJSONForDatabase() );
if ( $length > self::MAX_LENGTH ) {
return Status::newFatal( 'templatedata-invalid-length', $length, self::MAX_LENGTH );
return Status::newFatal(
'templatedata-invalid-length',
Message::numParam( $length ),
Message::numParam( self::MAX_LENGTH )
);
}
}
return $status;