Commit b48411a8 authored by chrisgarrity's avatar chrisgarrity

Link to pt-br downloads if locale is pt-br

parent 4e49653f
......@@ -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(<Page><Download /></Page>, document.getElementById('app'));
var IntlDownload = injectIntl(Download);
render(<Page><IntlDownload /></Page>, document.getElementById('app'));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment