Skip to content

Commit 85b1b1c

Browse files
committed
Move Cookie/Legal Copy to translations json
1 parent eaeb40c commit 85b1b1c

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

client/modules/IDE/components/About.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function About(props) {
155155
aria-hidden="true"
156156
focusable="false"
157157
/>
158-
Privacy Policy
158+
{t('About.PrivacyPolicy')}
159159
</Link>
160160
</p>
161161
<p className="about__content-column-list">
@@ -165,7 +165,7 @@ function About(props) {
165165
aria-hidden="true"
166166
focusable="false"
167167
/>
168-
Terms of Use
168+
{t('About.TermsOfUse')}
169169
</Link>
170170
</p>
171171
<p className="about__content-column-list">
@@ -175,7 +175,7 @@ function About(props) {
175175
aria-hidden="true"
176176
focusable="false"
177177
/>
178-
Code of Conduct
178+
{t('About.CodeOfConduct')}
179179
</Link>
180180
</p>
181181
</div>

client/modules/IDE/pages/Legal.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
44
import { browserHistory } from 'react-router';
55
import styled from 'styled-components';
6+
import { useTranslation } from 'react-i18next';
67
import PrivacyPolicy from './PrivacyPolicy';
78
import TermsOfUse from './TermsOfUse';
89
import CodeOfConduct from './CodeOfConduct';
@@ -30,6 +31,7 @@ const TabTitle = styled.p`
3031

3132
function Legal({ location }) {
3233
const [selectedIndex, setSelectedIndex] = useState(0);
34+
const { t } = useTranslation();
3335
useEffect(() => {
3436
if (location.pathname === '/privacy-policy') {
3537
setSelectedIndex(0);
@@ -60,13 +62,13 @@ function Legal({ location }) {
6062
<Tabs selectedIndex={selectedIndex} onSelect={onSelect}>
6163
<StyledTabList>
6264
<Tab>
63-
<TabTitle>Privacy Policy</TabTitle>
65+
<TabTitle>{t('Legal.PrivacyPolicy')}</TabTitle>
6466
</Tab>
6567
<Tab>
66-
<TabTitle>Terms of Use</TabTitle>
68+
<TabTitle>{t('Legal.TermsOfUse')}</TabTitle>
6769
</Tab>
6870
<Tab>
69-
<TabTitle>Code of Conduct</TabTitle>
71+
<TabTitle>{t('Legal.CodeOfConduct')}</TabTitle>
7072
</Tab>
7173
</StyledTabList>
7274
<TabPanel>

client/modules/User/components/CookieConsent.jsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import styled from 'styled-components';
55
import ReactGA from 'react-ga';
66
import { Transition } from 'react-transition-group';
77
import { Link } from 'react-router';
8+
import { Trans, useTranslation } from 'react-i18next';
89
import getConfig from '../../../utils/getConfig';
910
import { setUserCookieConsent } from '../actions';
1011
import { remSize, prop, device } from '../../../theme';
@@ -76,6 +77,7 @@ function CookieConsent() {
7677
const [cookieConsent, setBrowserCookieConsent] = useState('none');
7778
const [inProp, setInProp] = useState(false);
7879
const dispatch = useDispatch();
80+
const { t } = useTranslation();
7981

8082
function initializeCookieConsent() {
8183
if (user.authenticated) {
@@ -157,29 +159,23 @@ function CookieConsent() {
157159
{(state) => (
158160
<CookieConsentContainer state={state}>
159161
<CookieConsentDialog role="dialog" tabIndex="0">
160-
{/* <button aria-label="Close" tabIndex="0"></button> */}
161-
<CookieConsentHeader>Cookies</CookieConsentHeader>
162+
<CookieConsentHeader>{t('Cookies.Header')}</CookieConsentHeader>
162163
<CookieConsentContent>
163164
<CookieConsentCopy>
164-
The p5.js Editor uses cookies. Some are essential to the website
165-
functionality and allow you to manage an account and
166-
preferences. Others are not essential—they are used for
167-
analytics and allow us to learn more about our community.{' '}
168-
<strong>
169-
We never sell this data or use it for advertising.
170-
</strong>{' '}
171-
You can decide which cookies you would like to allow, and learn
172-
more in our <Link to="/privacy-policy">Privacy Policy</Link>.
165+
<Trans
166+
i18nKey="Cookies.Body"
167+
components={[<Link to="/privacy-policy" />]}
168+
/>
173169
</CookieConsentCopy>
174170
<CookieConsentButtons>
175171
<Button
176172
kind={Button.kinds.secondary}
177173
onClick={acceptAllCookies}
178174
>
179-
Allow All
175+
{t('Cookies.AllowAll')}
180176
</Button>
181177
<Button onClick={acceptEssentialCookies}>
182-
Allow Essential
178+
{t('Cookies.AllowEssential')}
183179
</Button>
184180
</CookieConsentButtons>
185181
</CookieConsentContent>
@@ -189,6 +185,5 @@ function CookieConsent() {
189185
</Transition>
190186
);
191187
}
192-
// TODO need to merge browser cookie with user when u login
193188

194189
export default CookieConsent;

translations/locales/en-US/translations.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@
9696
"Resources": "Resources",
9797
"Libraries": "Libraries",
9898
"Forum": "Forum",
99-
"Examples": "Examples"
99+
"Examples": "Examples",
100+
"PrivacyPolicy": "Privacy Policy",
101+
"TermsOfUse": "Terms of Use",
102+
"CodeOfConduct": "Code of Conduct"
100103
},
101104
"Toast": {
102105
"OpenedNewSketch": "Opened new sketch.",
@@ -599,5 +602,16 @@
599602
},
600603
"Explorer": {
601604
"Files": "Files"
605+
},
606+
"Cookies": {
607+
"Header": "Cookies",
608+
"Body": "The p5.js Editor uses cookies. Some are essential to the website functionality and allow you to manage an account and preferences. Others are not essential—they are used for analytics and allow us to learn more about our community. <strong> We never sell this data or use it for advertising. </strong> You can decide which cookies you would like to allow, and learn more in our <0>Privacy Policy<0>.",
609+
"AllowAll": "Allow All",
610+
"AllowEssential": "Allow Essential"
611+
},
612+
"Legal": {
613+
"PrivacyPolicy": "Privacy Policy",
614+
"TermsOfUse": "Terms of Use",
615+
"CodeOfConduct": "Code of Conduct"
602616
}
603617
}

0 commit comments

Comments
 (0)