Changeset 585


Ignore:
Timestamp:
09/23/06 17:47:02 (13 years ago)
Author:
ray
Message:

HTMLArea._lc (): Alternative way of passing dynamic replacements to localization. See #854

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/htmlarea.js

    r565 r585  
    63606360 
    63616361/** Return a localised string. 
    6362  * @param string    English language string 
     6362 * @param string    English language string. It can also contain variables in the form "Some text with $variable=replaced text$".  
     6363 *                  This replaces $variable in "Some text with $variable" with "replaced text" 
    63636364 * @param context   Case sensitive context name, eg 'HTMLArea' (default), 'TableOperations'... 
    63646365 * @param replace   Replace $variables in String, eg {foo: 'replaceText'} ($foo in string will be replaced) 
     
    63676368{ 
    63686369  var ret; 
     6370  if (typeof string == 'string') var m = string.match(/\$(.*?)=(.*?)\$/g); 
     6371  if (m)  
     6372  { 
     6373    if (!replace) replace = {}; 
     6374    for (var i = 0;i<m.length;i++) 
     6375    { 
     6376      var n = m[i].match(/\$(.*?)=(.*?)\$/); 
     6377      replace[n[1]] = n[2]; 
     6378      string = string.replace(n[0],'$'+n[1]); 
     6379    } 
     6380  } 
    63696381  if ( _editor_lang == "en" ) 
    63706382  { 
Note: See TracChangeset for help on using the changeset viewer.