From b0f95a7acefddc4ccdacad3a0ca9f3c15f3a57ac Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Thu, 12 Nov 2020 10:59:45 +0000 Subject: [PATCH] [FIX] website_blog: make twitter share string translatable Previously the default message when sharing a blog article was hardcoded, meaning it was always in English and not translatable, this commit fixes that. Closes https://github.com/odoo/odoo/issues/31173 task-2369420 closes odoo/odoo#62118 X-original-commit: fab72412b973eeec503279f498d18006a584c1c0 Signed-off-by: Quentin Smetz (qsm) --- addons/website_blog/i18n/website_blog.pot | 7 +++++++ addons/website_blog/static/src/js/website_blog.js | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/website_blog/i18n/website_blog.pot b/addons/website_blog/i18n/website_blog.pot index feb6d9d37fe..5c5ade58c27 100644 --- a/addons/website_blog/i18n/website_blog.pot +++ b/addons/website_blog/i18n/website_blog.pot @@ -314,6 +314,13 @@ msgstr "" msgid "Along those lines, how difficult is the set up and break down?" msgstr "" +#. module: website_blog +#. openerp-web +#: code:addons/website_blog/static/src/js/website_blog.js:77 +#, python-format +msgid "Amazing blog article: %s! Check it live: %s" +msgstr "" + #. module: website_blog #. openerp-web #: code:addons/website_blog/static/src/snippets/s_latest_posts/000.js:0 diff --git a/addons/website_blog/static/src/js/website_blog.js b/addons/website_blog/static/src/js/website_blog.js index 3286f553121..7131f275d00 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -1,5 +1,6 @@ odoo.define('website_blog.website_blog', function (require) { 'use strict'; +var core = require('web.core'); const dom = require('web.dom'); const publicWidget = require('web.public.widget'); @@ -73,7 +74,9 @@ publicWidget.registry.websiteBlog = publicWidget.Widget.extend({ var blogPostTitle = encodeURIComponent($('#o_wblog_post_name').html() || ''); var articleURL = encodeURIComponent(window.location.href); if ($element.hasClass('o_twitter')) { - url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=Amazing blog article : ' + blogPostTitle + "! " + articleURL; + var twitterText = core._t("Amazing blog article: %s! Check it live: %s"); + var tweetText = _.string.sprintf(twitterText, blogPostTitle, articleURL); + url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=' + tweetText; } else if ($element.hasClass('o_facebook')) { url = 'https://www.facebook.com/sharer/sharer.php?u=' + articleURL; } else if ($element.hasClass('o_linkedin')) {