Development

Changeset 33251

You must first sign up to be able to contribute.

Changeset 33251

Show
Ignore:
Timestamp:
12/12/11 17:30:59 (1 year ago)
Author:
fabien
Message:

[1.4] fixed sfChoiceFormat when a string to translate contains a valid range (closes #9973)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.4/lib/i18n/sfChoiceFormat.class.php

    r23810 r33251  
    6666   * The pattern to parse the formatting string. 
    6767   */ 
    68   protected $parse = '/\s*\|?([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/'; 
     68  protected $parse = '/(?:^\s*|\s*\|)([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/'; 
    6969 
    7070  /** 
  • branches/1.4/test/unit/i18n/sfChoiceFormatTest.php

    r19531 r33251  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(89); 
     13$t = new lime_test(90); 
    1414 
    1515$n = new sfChoiceFormat(); 
     
    9898$t->is($n->format($strings[4][0], 12), $strings[4][1][1][2], '->format() returns the string that match the number'); 
    9999 
     100// test strings with some set notation 
     101$t->is($n->format("[0]Some text|[1,Inf] Some text (10)", 12), 'Some text (10)', '->format() does not take into account ranges that are not prefixed with |'); 
     102 
    100103// test set notation 
    101104// tests adapted from Prado unit test suite