summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/src/Validation/Validators/PythonInterpolationValidator.php')
-rw-r--r--MLEB/Translate/src/Validation/Validators/PythonInterpolationValidator.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/MLEB/Translate/src/Validation/Validators/PythonInterpolationValidator.php b/MLEB/Translate/src/Validation/Validators/PythonInterpolationValidator.php
new file mode 100644
index 00000000..ca9a98e3
--- /dev/null
+++ b/MLEB/Translate/src/Validation/Validators/PythonInterpolationValidator.php
@@ -0,0 +1,18 @@
+<?php
+declare( strict_types = 1 );
+
+namespace MediaWiki\Extension\Translate\Validation\Validators;
+
+/**
+ * An insertable python interpolation validator that also acts as an InsertableSuggester
+ * @author Abijeet Patro
+ * @license GPL-2.0-or-later
+ * @since 2020.02
+ */
+class PythonInterpolationValidator extends InsertableRegexValidator {
+ public function __construct() {
+ parent::__construct( '/\%(?:\([a-zA-Z0-9_]*?\))?[diouxXeEfFgGcrs]/U' );
+ }
+}
+
+class_alias( PythonInterpolationValidator::class, '\MediaWiki\Extensions\Translate\PythonInterpolationValidator' );