Skip to content

Commit

Permalink
Added translated title on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
kachar committed Mar 2, 2021
1 parent a09cda3 commit 0fb9073
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions public/locales/bg/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"changePassword": "Смяна на парола",
"forgottenPassword": "Забравена парола?"
},
"meta": {
"title": "Подкрепи БГ"
},
"values": {
"voluntary": {
"heading": "Доброволно и про-боно",
Expand Down
3 changes: 3 additions & 0 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"changePassword": "Change your password",
"forgottenPassword": "Forgotten password?"
},
"meta": {
"title": "Podkrepi BG"
},
"values": {
"voluntary": {
"heading": "Voluntary and pro-bono",
Expand Down
8 changes: 6 additions & 2 deletions src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Head from 'next/head'
import { useState } from 'react'
import { useMemo, useState } from 'react'
import { useTranslation } from 'next-i18next'
import {
Box,
Container,
Expand Down Expand Up @@ -49,12 +50,15 @@ export default function Layout({
...containerProps
}: LayoutProps) {
const classes = useStyles()
const { t } = useTranslation()
const [mobileOpen, setMobileOpen] = useState(false)
const navMenuToggle = () => setMobileOpen(!mobileOpen)
const suffix = t('meta.title')
const metaTitle = useMemo(() => (title ? `${title} | ${suffix}` : suffix), [title, suffix])
return (
<Container className={classes.layout} maxWidth={maxWidth} {...containerProps}>
<Head>
<title>{title}</title>
<title>{metaTitle}</title>
</Head>
<Box pt={4} pb={10}>
<AppNavBar navMenuToggle={navMenuToggle} />
Expand Down

0 comments on commit 0fb9073

Please sign in to comment.