Changeset 1410

Show
Ignore:
Timestamp:
14/12/09 13:20:55 (3 months ago)
Author:
karel
Message:

Calling exec on a regexp requires that you reset the lastIndex to 0 if you want to reuse the same regexp object on another string.
Alternative is to use regexp.test (and RegExp?.$... to inspect the result)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/modules/kauri-jquery/src/main/kauri/static-{build}.key/kauri.util/locale.js

    r1395 r1410  
    3535    } 
    3636 
    37     var I18N_PREFIX_REGEX = /^i18n:(.*)$/g
     37    var I18N_PREFIX_REGEX = /^i18n:(.*)$/
    3838    /** 
    3939     * Builds up the message by applying i18n lookups and argument-formatting 
     
    4545        key = key || "No message specified."; 
    4646        var text = key; 
    47         var result = I18N_PREFIX_REGEX.exec(key); 
    48         if (result) 
    49             text = locale.getMessage(result[1]); 
     47        if (I18N_PREFIX_REGEX.test(key)) { 
     48            text = locale.getMessage(RegExp.$1); 
     49        } 
    5050 
    5151        args = args || []; // guarantee we pass an array down to the format function.