فهرست منبع

[Locale] add support for L, which is the same as M

Igor Wiedler 14 سال پیش
والد
کامیت
ae3ee5d896

+ 2 - 1
src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php

@@ -40,7 +40,7 @@ class StubIntlDateFormatter
 
     public function format($timestamp)
     {
-        $regExp = "/('(M+|y+|d+|G+|Q+|q+|[^MydGQq])|M+|y+|d+|G+|Q+|q+)/";
+        $regExp = "/('(M+|L+|y+|d+|G+|Q+|q+|[^MLydGQq])|M+|L+|y+|d+|G+|Q+|q+)/";
 
         $callback = function($matches) use ($timestamp) {
             $pattern = $matches[0];
@@ -52,6 +52,7 @@ class StubIntlDateFormatter
 
             switch ($pattern[0]) {
                 case 'M':
+                case 'L':
                     $matchLengthMap = array(
                         1   => 'n',
                         2   => 'm',

+ 7 - 0
tests/Symfony/Tests/Component/Locale/Stub/StubIntlDateFormatterTest.php

@@ -36,6 +36,13 @@ class StubIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
             array('MMMMM', 0, 'J'),
             array('MMMMMM', 0, '00001'),
 
+            array('L', 0, '1'),
+            array('LL', 0, '01'),
+            array('LLL', 0, 'Jan'),
+            array('LLLL', 0, 'January'),
+            array('LLLLL', 0, 'J'),
+            array('LLLLLL', 0, '00001'),
+
             /* years */
             array('y', 0, '1970'),
             array('yy', 0, '70'),