Fixing translation behavior of download link labels

This commit is contained in:
Jeff Avallone 2018-06-01 17:59:24 -04:00
parent cda91cd3f5
commit 919612bc0d
3 changed files with 9 additions and 5 deletions

View File

@ -42,7 +42,7 @@ class App extends React.PureComponent {
this.setState({ this.setState({
svgUrl: { svgUrl: {
url: URL.createObjectURL(blob), url: URL.createObjectURL(blob),
label: this.props.t('Download SVG'), label: 'Download SVG',
filename: 'image.svg', filename: 'image.svg',
type type
} }
@ -61,7 +61,7 @@ class App extends React.PureComponent {
this.setState({ this.setState({
pngUrl: { pngUrl: {
url: URL.createObjectURL(blob), url: URL.createObjectURL(blob),
label: this.props.t('Download PNG'), label: 'Download PNG',
filename: 'image.png', filename: 'image.png',
type type
} }

View File

@ -107,7 +107,9 @@ exports[`Form rendering with download URLs 1`] = `
type="image/svg+xml" type="image/svg+xml"
> >
<SvgMock /> <SvgMock />
<Trans>
Download SVG Download SVG
</Trans>
</a> </a>
</li> </li>
<li <li
@ -119,7 +121,9 @@ exports[`Form rendering with download URLs 1`] = `
type="image/png" type="image/png"
> >
<SvgMock /> <SvgMock />
<Trans>
Download PNG Download PNG
</Trans>
</a> </a>
</li> </li>
</ul> </ul>

View File

@ -66,7 +66,7 @@ class Form extends React.PureComponent {
return downloadUrls.map(({ url, filename, type, label }, i) => <li key={ i }> return downloadUrls.map(({ url, filename, type, label }, i) => <li key={ i }>
<a href={ url } download={ filename } type={ type }> <a href={ url } download={ filename } type={ type }>
<DownloadIcon/>{ label } <DownloadIcon/><Trans>{ label }</Trans>
</a> </a>
</li>); </li>);
} }