From b48411a8e429f107877c2c5ef53908c5ab19b4ca Mon Sep 17 00:00:00 2001 From: chrisgarrity Date: Tue, 19 Sep 2017 08:19:36 -0400 Subject: [PATCH] Link to pt-br downloads if locale is pt-br --- src/views/download/download.jsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/views/download/download.jsx b/src/views/download/download.jsx index 8eca5196b..fe774218d 100644 --- a/src/views/download/download.jsx +++ b/src/views/download/download.jsx @@ -3,6 +3,7 @@ var render = require('../../lib/render.jsx'); var FormattedHTMLMessage = require('react-intl').FormattedHTMLMessage; var FormattedMessage = require('react-intl').FormattedMessage; +var injectIntl = require('react-intl').injectIntl; var api = require('../../lib/api'); var Page = require('../../components/page/www/page.jsx'); @@ -21,9 +22,13 @@ var Download = React.createClass({ }; }, componentDidMount: function () { + var uri = '/scratchr2/static/sa/version.xml'; + if (this.props.intl.locale === 'pt-br') { + uri = '/scratchr2/static/sa/pt-br/version.xml'; + } api({ host: '', - uri: '/scratchr2/static/sa/version.xml', + uri: uri, responseType: 'string' }, function (err, body, res) { if (err || res.statusCode >= 400) { @@ -39,12 +44,16 @@ var Download = React.createClass({ }.bind(this)); }, render: function () { + var downloadPath = '/scratchr2/static/sa/Scratch-'; + if (this.props.intl.locale === 'pt-br') { + downloadPath = '/scratchr2/static/sa/pt-br/Scratch-'; + } if (this.state.swfVersion.length > 0 && this.state.swfVersion !== -1) { var downloadUrls = { - mac: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.dmg', - mac105: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.air', - windows: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.exe', - linux: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.air' + mac: downloadPath + this.state.swfVersion + '.dmg', + mac105: downloadPath + this.state.swfVersion + '.air', + windows: downloadPath + this.state.swfVersion + '.exe', + linux: downloadPath + this.state.swfVersion + '.air' }; } @@ -233,4 +242,5 @@ var Download = React.createClass({ } }); -render(, document.getElementById('app')); +var IntlDownload = injectIntl(Download); +render(, document.getElementById('app'));