diff --git a/src/Filters/Sprintf/language/de-AT/not_allowed.php b/src/Filters/Sprintf/language/de-AT/not_allowed.php deleted file mode 100644 index cf72a96..0000000 --- a/src/Filters/Sprintf/language/de-AT/not_allowed.php +++ /dev/null @@ -1,10 +0,0 @@ - [ - 'type' => 'exact' - ], - '%ige' => [ - 'type' => 'exact' - ], -]; \ No newline at end of file diff --git a/src/Filters/Sprintf/language/de-CH/not_allowed.php b/src/Filters/Sprintf/language/de-CH/not_allowed.php deleted file mode 100644 index cf72a96..0000000 --- a/src/Filters/Sprintf/language/de-CH/not_allowed.php +++ /dev/null @@ -1,10 +0,0 @@ - [ - 'type' => 'exact' - ], - '%ige' => [ - 'type' => 'exact' - ], -]; \ No newline at end of file diff --git a/src/Filters/Sprintf/language/de-DE/not_allowed.php b/src/Filters/Sprintf/language/de-DE/not_allowed.php deleted file mode 100644 index cf72a96..0000000 --- a/src/Filters/Sprintf/language/de-DE/not_allowed.php +++ /dev/null @@ -1,10 +0,0 @@ - [ - 'type' => 'exact' - ], - '%ige' => [ - 'type' => 'exact' - ], -]; \ No newline at end of file diff --git a/src/Filters/SprintfToPH.php b/src/Filters/SprintfToPH.php index d755881..df9a8b8 100644 --- a/src/Filters/SprintfToPH.php +++ b/src/Filters/SprintfToPH.php @@ -33,6 +33,12 @@ public function __construct() { * 20%-zar - ignored * * + * @see + * - https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265-SW1 + * - https://en.cppreference.com/w/c/io/fprintf + * - https://www.php.net/manual/en/function.sprintf.php + * - https://www.w3resource.com/c-programming/stdio/c_library_method_sprintf.php + * * @param $segment * * @return string @@ -45,7 +51,7 @@ public function transform( $segment ) { $segment = $sprintfLocker->lock( $segment ); // Octal parsing is disabled due to Hungarian percentages 20%-os - $regex = '/(?:\x25\x25)|(\x25(?:(?:[1-9]\d*)\$|\((?:[^\)]+)\))?(?:\+)?(?:0|[+-]?\'[^$])?(?:-)?(?:\d+)?(?:\.(?:\d+))?((?:[hjlqtzL]{0,2}([ac-gopsuxAC-GOSUX]{1})|(\-[a-z]{1,3}))(?![\d\w])|(?:#@[\w]+@)|(?:@)))/'; + $regex = '/(?:\x25\x25)|(\x25(?:(?:[1-9]\d*)\$|\((?:[^\)]+)\))?(?:\+)?(?:0|[+-]?\'[^$])?(?:-)?(?:\d+)?(?:\.(?:\d+))?((?:[hjlqtzL]{0,2}[ac-giopsuxAC-GOSUX]{1})(?![\d\w])|(?:#@[\w]+@)|(?:@)))/'; preg_match_all( $regex, $segment, $vars, PREG_SET_ORDER ); diff --git a/tests/SprintfTest.php b/tests/SprintfTest.php index 523f94f..8f932eb 100644 --- a/tests/SprintfTest.php +++ b/tests/SprintfTest.php @@ -96,14 +96,6 @@ private function runTests($notAllowed, $languageToTest) $this->assertEquals($segment, $segmentL1); $this->assertEquals($segment, $segmentL2); - - $filter = MateCatFilter::getInstance( new FeatureSet(), 'en-US', 'it-IT' ); - - $segmentL1 = $filter->fromLayer0ToLayer1( $segment ); - $segmentL2 = $filter->fromLayer0ToLayer2( $segment ); - - $this->assertNotEquals($segment, $segmentL1); - $this->assertNotEquals($segment, $segmentL2); } } } \ No newline at end of file