Sfoglia il codice sorgente

fb.ui.fbIntl has localTokenFuns arg

Herbert Vojčík 13 anni fa
parent
commit
ef454f4dbc
1 ha cambiato i file con 5 aggiunte e 4 eliminazioni
  1. 5 4
      lib-app/facebook-ext.js

+ 5 - 4
lib-app/facebook-ext.js

@@ -71,25 +71,26 @@ fb.ui = {
    * that is inserted as <br />, optional).
    * fbIntl.tokens contains functions that populate token bodies,
    * you should populate it if you want to have FB_INTL_TOKENs inserted.
+   * Token populator functions in localTokenFuns arg are also used, if supplied.
    * If replacer function does not exist, the token is not inserted
    * and no warning or error is raised.
    */
-  fbIntl: function fbIntl (element) {
+  fbIntl: function fbIntl (element, localTokenFuns) {
     var result = FB_INTL({desc: element.desc});
 
     var body = [element.body];
 
     var tokens = element.tokens ? element.tokens.split(",") : [],
       tokenFuns = fbIntl.tokens;
+    if (!localTokenFuns) { localTokenFuns = {}; }
     if (element.multiline) {
       tokens.push(element.multiline);
-      tokenFuns = object(tokenFuns);
       var br = BR();
-      tokenFuns[element.multiline] = function () { return br; };
+      localTokenFuns[element.multiline] = function () { return br; };
     }
 
     tokens.forEach(function (token) {
-      var f = tokenFuns[token];
+      var f = localTokenFuns[token] || tokenFuns[token];
       if (f) {
         if (f.direct) {
           splitReplace(body, "{"+token+"}", f(token, element));