summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/coresetup.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-07-02 09:14:28 +0200
committerXavier Morel <xmo@openerp.com>2012-07-02 09:14:28 +0200
commit3589e1d0f4aa21bc3bbab86657b7732822c63c45 (patch)
treef4787fd26d1affa0b7f211485f66d314562723d3 /addons/web/static/src/js/coresetup.js
parentd5bd3aff48f4252eaac2e2f7f7d9ebafba1b6879 (diff)
parent1c7f37d301c53a812b025044c2b938ae7e2af505 (diff)
[MERGE] jQuery.timeago translation support, re-extract POTs
bzr revid: xmo@openerp.com-20120702071428-0y2wuvn8wajvi6we
Diffstat (limited to 'addons/web/static/src/js/coresetup.js')
-rw-r--r--addons/web/static/src/js/coresetup.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js
index ee421bee092..a00ca4002e5 100644
--- a/addons/web/static/src/js/coresetup.js
+++ b/addons/web/static/src/js/coresetup.js
@@ -608,15 +608,31 @@ 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);
- }
- });
+var _t = instance.web._t;
+/*
+ * Strings in timeago are "composed" with prefixes, words and suffixes. This
+ * makes their detection by our translating system impossible. Use all literal
+ * strings we're using with a translation mark here so the extractor can do its
+ * job.
+ */
+{
+ _t('less than a minute ago');
+ _t('about a minute ago');
+ _t('%d minutes ago');
+ _t('about an hour ago');
+ _t('%d hours ago');
+ _t('a day ago');
+ _t('%d days ago');
+ _t('about a month ago');
+ _t('%d months ago');
+ _t('about a year ago');
+ _t('%d years ago');
}
-instance.connection.on('module_loaded', this, timeago_setup);
+
+instance.connection.on('module_loaded', this, function () {
+ // provide timeago.js with our own translator method
+ $.timeago.settings.translator = instance.web._t;
+});
/**
* Registry for all the client actions key: tag value: widget