From 8e34b97b090b7b3dc80875c2932af8f04bc5487b Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 20 Oct 2011 11:15:27 +0200 Subject: [PATCH] [ADD] Add format_text_node callback in qweb instance. Will be used for translations bzr revid: fme@openerp.com-20111020091527-wxnw5kfpucvlncif --- addons/web/static/lib/qweb/qweb2.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index 621ea39c74f..5785ddaaa30 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -207,6 +207,7 @@ QWeb2.Engine = (function() { this.reserved_words = QWeb2.RESERVED_WORDS.slice(0); this.actions_precedence = QWeb2.ACTIONS_PRECEDENCE.slice(0); this.word_replacement = QWeb2.tools.extend({}, QWeb2.WORD_REPLACEMENT); + this.format_text_node = null; for (var i = 0; i < arguments.length; i++) { this.add_template(arguments[i]); } @@ -486,12 +487,16 @@ QWeb2.Element = (function() { }, _compile : function() { switch (this.node.nodeType) { - case 3: - case 4: - this.top_string(this.node.data); + case 3: + case 4: + var text = this.node.data; + if (this.engine.format_text_node) { + text = this.engine.format_text_node.call(this, text); + } + this.top_string(text); break; - case 1: - this.compile_element(); + case 1: + this.compile_element(); } var r = this._top.join(''); if (this.process_children) {