From 26dc7e2fa936dd1692a6d9fe767cde520695042b Mon Sep 17 00:00:00 2001 From: Vishmita Date: Thu, 21 Jun 2012 14:34:25 +0530 Subject: [FIX]Minor changes. bzr revid: vja@tinyerp.com-20120621090425-wa3lrw5tait9lt9s --- addons/web/static/src/js/coresetup.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/coresetup.js') diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 8e7b5d4f75d..b8924d81680 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -332,11 +332,14 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess .appendTo(document.body) .load(function () { try { - if (options.error) { - options.error(JSON.parse( - this.contentDocument.body.childNodes[1].textContent - )); - } + if (options.error) { + if (!this.contentDocument.body.childNodes[1]) { + options.error(this.contentDocument.body.childNodes); + } + else { + options.error(JSON.parse(this.contentDocument.body.childNodes[1].textContent)); + } + } } finally { complete(); } -- cgit v1.2.3 From cc2d116e47e27eccc00ec215c3fe3ef1f65f13cb Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Mon, 25 Jun 2012 17:35:45 +0200 Subject: [IMP] better integration of openerp's i18n in timeago.js a suggestion for easier third party i18n integration will be made on the original project's git repo: https://github.com/rmm5t/jquery-timeago bzr revid: abo@openerp.com-20120625153545-zca7qljrizugxntk --- addons/web/static/src/js/coresetup.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'addons/web/static/src/js/coresetup.js') diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 99e134e7bd4..ace41234e0c 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -606,12 +606,7 @@ instance.web.qweb.preprocess_node = function() { /** Setup jQuery timeago */ var timeago_setup = function () { - var s = $.timeago.settings.strings; - _.each(s, function(v,k) { - if(_.isString(v)) { - s[k] = instance.web._t(v); - } - }); + $.timeago.settings.translator = instance.web._t; } instance.connection.on('module_loaded', this, timeago_setup); -- cgit v1.2.3 From 21cf7115be08aa00ed98bb33e753316737a8a8b6 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Thu, 28 Jun 2012 15:33:53 +0200 Subject: [IMP] make the strings composed by timeago.js easy to spot for launchpad rosetta by explicitly calling _t() method on them bzr revid: abo@openerp.com-20120628133353-7dx34sktz9eh3xxd --- addons/web/static/src/js/coresetup.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'addons/web/static/src/js/coresetup.js') diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index ace41234e0c..b599a543055 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -606,7 +606,28 @@ instance.web.qweb.preprocess_node = function() { /** Setup jQuery timeago */ var timeago_setup = function () { + // provide timeago.js with our own translator method $.timeago.settings.translator = instance.web._t; + + /* + * Strings in timeago are "composed" with prefixes, words and suffixes. + * This makes their detection by the translating system pretty much + * imposible, so we'll declare those which will be used in a more explicit + * way. + */ + var timeAgoStrings = [ + instance.web._t('less than a minute ago'), + instance.web._t('about a minute ago'), + instance.web._t('%d minutes ago'), + instance.web._t('about an hour ago'), + instance.web._t('%d hours ago'), + instance.web._t('a day ago'), + instance.web._t('%d days ago'), + instance.web._t('about a month ago'), + instance.web._t('%d months ago'), + instance.web._t('about a year ago'), + instance.web._t('%d years ago'), + ]; } instance.connection.on('module_loaded', this, timeago_setup); -- cgit v1.2.3