Skip to content

Commit 15191e9

Browse files
authored
localize main menu (#477)
* localize main menu * ♻️ Move close to glossary
1 parent 4aca13d commit 15191e9

File tree

4 files changed

+29
-9
lines changed

4 files changed

+29
-9
lines changed

packages/common/src/i18n/en.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default {
4444
friday: "Friday",
4545
saturday: "Saturday",
4646
},
47+
close: "Close",
4748
},
4849
hotlines: {
4950
nationalSuicidePreventionLifeline: {
@@ -206,4 +207,12 @@ export default {
206207
alerts: {
207208
closeAlerts: "Close Alerts",
208209
},
210+
mainMenu: {
211+
resourcesWithinReach: "Resources within reach",
212+
about: "About",
213+
termsOfUse: "Terms of Use",
214+
privacyPolicy: "Privacy Policy",
215+
home: "Home",
216+
favorites: "Favorites",
217+
},
209218
};

packages/common/src/i18n/es.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default {
4444
friday: "Viernes",
4545
saturday: "Sábado",
4646
},
47+
close: "Final",
4748
},
4849
hotlines: {
4950
nationalSuicidePreventionLifeline: {
@@ -208,4 +209,12 @@ export default {
208209
alerts: {
209210
closeAlerts: "Cerrar Alertas",
210211
},
212+
mainMenu: {
213+
resourcesWithinReach: "Recursos al Alcance",
214+
about: "Acerca de",
215+
termsOfUse: "Términos de Uso",
216+
privacyPolicy: "Política de Privacidad",
217+
home: "Casa",
218+
favorites: "Favoritos",
219+
},
211220
};

packages/web/src/components/MenuDrawer.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Link as RouterLink } from "react-router-dom";
2020
import { Theme } from "@material-ui/core/styles/createMuiTheme";
2121
import Typography from "@material-ui/core/Typography";
2222
import makeStyles from "@material-ui/styles/makeStyles";
23+
import { useTranslation } from "react-i18next";
2324

2425
const useStyles = makeStyles((theme: Theme) => ({
2526
drawerPaper: {
@@ -33,6 +34,7 @@ interface MenuDrawerProps {
3334
}
3435

3536
const MenuDrawer = ({ handleMenuClose, open }: MenuDrawerProps) => {
37+
const { t } = useTranslation(["mainMenu", "glossary"]);
3638
const classes = useStyles();
3739
return (
3840
<Drawer
@@ -43,7 +45,7 @@ const MenuDrawer = ({ handleMenuClose, open }: MenuDrawerProps) => {
4345
<Grid container direction="column">
4446
<Grid container item justify="flex-end">
4547
<IconButton onClick={() => handleMenuClose()}>
46-
<Typography variant="srOnly">close menu</Typography>
48+
<Typography variant="srOnly">{t("glossary:close")}</Typography>
4749
{CloseIcon}
4850
</IconButton>
4951
</Grid>
@@ -55,7 +57,7 @@ const MenuDrawer = ({ handleMenuClose, open }: MenuDrawerProps) => {
5557
onClick={() => handleMenuClose()}
5658
to="/"
5759
>
58-
<Typography variant="srOnly">home</Typography>
60+
<Typography variant="srOnly">{t("home")}</Typography>
5961
<Box maxWidth="100%" width={250}>
6062
<Logo />
6163
</Box>
@@ -67,7 +69,7 @@ const MenuDrawer = ({ handleMenuClose, open }: MenuDrawerProps) => {
6769
to="/about"
6870
>
6971
<ListItemIcon>{InfoIcon}</ListItemIcon>
70-
<ListItemText>About</ListItemText>
72+
<ListItemText>{t("about")}</ListItemText>
7173
</ListItem>
7274
<ListItem
7375
button
@@ -76,7 +78,7 @@ const MenuDrawer = ({ handleMenuClose, open }: MenuDrawerProps) => {
7678
to="/terms-of-use"
7779
>
7880
<ListItemIcon>{TermsOfServiceIcon}</ListItemIcon>
79-
<ListItemText>Terms of Use</ListItemText>
81+
<ListItemText>{t("termsOfUse")}</ListItemText>
8082
</ListItem>
8183
<ListItem
8284
button
@@ -85,7 +87,7 @@ const MenuDrawer = ({ handleMenuClose, open }: MenuDrawerProps) => {
8587
to="/privacy-policy"
8688
>
8789
<ListItemIcon>{PolicyIcon}</ListItemIcon>
88-
<ListItemText>Privacy policy</ListItemText>
90+
<ListItemText>{t("privacyPolicy")}</ListItemText>
8991
</ListItem>
9092
<ListItem
9193
button
@@ -94,7 +96,7 @@ const MenuDrawer = ({ handleMenuClose, open }: MenuDrawerProps) => {
9496
to="/favorites"
9597
>
9698
<ListItemIcon>{FavoriteIcon}</ListItemIcon>
97-
<ListItemText>Favorites</ListItemText>
99+
<ListItemText>{t("favorites")}</ListItemText>
98100
</ListItem>
99101
</List>
100102
</Grid>

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4271,9 +4271,9 @@ caniuse-api@^3.0.0:
42714271
lodash.uniq "^4.5.0"
42724272

42734273
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001039, caniuse-lite@^1.0.30001043:
4274-
version "1.0.30001170"
4275-
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001170.tgz"
4276-
integrity sha512-Dd4d/+0tsK0UNLrZs3CvNukqalnVTRrxb5mcQm8rHL49t7V5ZaTygwXkrq+FB+dVDf++4ri8eJnFEJAB8332PA==
4274+
version "1.0.30001238"
4275+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001238.tgz"
4276+
integrity sha512-bZGam2MxEt7YNsa2VwshqWQMwrYs5tR5WZQRYSuFxsBQunWjBuXhN4cS9nV5FFb1Z9y+DoQcQ0COyQbv6A+CKw==
42774277

42784278
canonical-instance@^2.0.0:
42794279
version "2.0.0"

0 commit comments

Comments
 (0)