Index: trunk/extensions/Translate/FFS.php |
— | — | @@ -609,7 +609,7 @@ |
610 | 610 | |
611 | 611 | // Put the "other" alternative last, without other= prefix |
612 | 612 | $other = isset($messages['other']) ? '|' . $messages['other'] : ''; |
613 | | - $pls .= "$other|}}"; |
| 613 | + $pls .= "$other}}"; |
614 | 614 | return $pls; |
615 | 615 | } |
616 | 616 | |
— | — | @@ -622,13 +622,13 @@ |
623 | 623 | |
624 | 624 | // Replace all variables with placeholders. Possible source of bugs |
625 | 625 | // if other characters that given below are used. |
626 | | - $regex = '~\{\{a-zA-Z_-}}~'; |
| 626 | + $regex = '~\{\{[a-zA-Z_-]+}}~'; |
627 | 627 | $placeholders = array(); |
628 | 628 | $match = null; |
629 | | - while ( preg_match( $other, $message, $match ) ) { |
630 | | - $key = self::placeholder(); |
631 | | - $placeholders[$key] = $match[0]; |
632 | | - $message = preg_replace( $other, $key, $message ); |
| 629 | + while ( preg_match( $regex, $message, $match ) ) { |
| 630 | + $uniqkey = self::placeholder(); |
| 631 | + $placeholders[$uniqkey] = $match[0]; |
| 632 | + $message = preg_replace( $regex, $uniqkey, $message ); |
633 | 633 | } |
634 | 634 | |
635 | 635 | // Then replace (possible multiple) plural instances into placeholders |
— | — | @@ -636,9 +636,9 @@ |
637 | 637 | $matches = array(); |
638 | 638 | $match = null; |
639 | 639 | while ( preg_match( $regex, $message, $match ) ) { |
640 | | - $key = self::placeholder(); |
641 | | - $matches[$key] = $match; |
642 | | - $message = preg_replace( $regex, $key, $message ); |
| 640 | + $uniqkey = self::placeholder(); |
| 641 | + $matches[$uniqkey] = $match; |
| 642 | + $message = preg_replace( $regex, $uniqkey, $message ); |
643 | 643 | } |
644 | 644 | |
645 | 645 | // No plurals, should not happen |
— | — | @@ -655,6 +655,7 @@ |
656 | 656 | foreach ( $matches as $ph => $plu ) { |
657 | 657 | $forms = explode( '|', $plu[1] ); |
658 | 658 | foreach ( $forms as $form ) { |
| 659 | + if ( $form === '' ) continue; |
659 | 660 | $match = array(); |
660 | 661 | if ( preg_match( $regex, $form, $match ) ) { |
661 | 662 | $formWord = "$key.{$match[1]}"; |
— | — | @@ -680,6 +681,6 @@ |
681 | 682 | |
682 | 683 | protected function placeholder() { |
683 | 684 | static $i = 0; |
684 | | - return "\x7fUNIQ" . dechex(mt_rand(0, 0x7fffffff)) . dechex(mt_rand(0, 0x7fffffff)) . '|' . $i++; |
| 685 | + return "\x7fUNIQ" . dechex(mt_rand(0, 0x7fffffff)) . dechex(mt_rand(0, 0x7fffffff)) . $i++; |
685 | 686 | } |
686 | 687 | } |
\ No newline at end of file |