Skip to content

Commit be0ce89

Browse files
authored
Merge pull request #3662 from cassiano/translating-donate-link-from-react
Translating the `Donate` button from React
2 parents f98e7d6 + 72b060d commit be0ce89

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

client/index.jsx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { render } from 'react-dom';
33
import { Provider } from 'react-redux';
44
import { Router } from 'react-router-dom';
55

6+
import { useTranslation } from 'react-i18next';
67
import browserHistory from './browserHistory';
78
import configureStore from './store';
89
import Routing from './routes';
@@ -63,14 +64,32 @@ if (
6364
document.body.appendChild(buttonScript);
6465
}
6566

66-
const App = () => (
67-
<div>
68-
<Router history={browserHistory}>
69-
<SkipLink targetId="play-sketch" text="PlaySketch" />
70-
<Routing />
71-
</Router>
72-
</div>
73-
);
67+
const App = () => {
68+
const { t } = useTranslation();
69+
70+
setTimeout(() => {
71+
const donateButton = document.getElementsByClassName(
72+
'dbox-donation-button'
73+
)[0];
74+
75+
if (donateButton) {
76+
const donateLogoImage = document.createElement('img');
77+
donateLogoImage.src = 'https://donorbox.org/images/white_logo.svg';
78+
79+
donateButton.text = t('About.Donate');
80+
donateButton.prepend(donateLogoImage);
81+
}
82+
}, 0);
83+
84+
return (
85+
<div>
86+
<Router history={browserHistory}>
87+
<SkipLink targetId="play-sketch" text="PlaySketch" />
88+
<Routing />
89+
</Router>
90+
</div>
91+
);
92+
};
7493

7594
render(
7695
<Provider store={store}>

0 commit comments

Comments
 (0)