|
@@ -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));
|