[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) <qsm@odoo.com>
This commit is contained in:
Samuel Degueldre
2020-11-22 14:03:33 +00:00
committed by qsm-odoo
parent 1051b28970
commit b0f95a7ace
2 changed files with 11 additions and 1 deletions
@@ -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
@@ -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')) {