From 0fb90734632e7ad87d5ecd0778cfac96e3f09542 Mon Sep 17 00:00:00 2001 From: Ilko Kacharov Date: Tue, 2 Mar 2021 19:41:43 +0200 Subject: [PATCH] Added translated title on homepage --- public/locales/bg/common.json | 3 +++ public/locales/en/common.json | 3 +++ src/components/layout/Layout.tsx | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/public/locales/bg/common.json b/public/locales/bg/common.json index 93beb3339..3ae9d2ded 100644 --- a/public/locales/bg/common.json +++ b/public/locales/bg/common.json @@ -13,6 +13,9 @@ "changePassword": "Смяна на парола", "forgottenPassword": "Забравена парола?" }, + "meta": { + "title": "Подкрепи БГ" + }, "values": { "voluntary": { "heading": "Доброволно и про-боно", diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 00cd2a6a0..a3b54b556 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -13,6 +13,9 @@ "changePassword": "Change your password", "forgottenPassword": "Forgotten password?" }, + "meta": { + "title": "Podkrepi BG" + }, "values": { "voluntary": { "heading": "Voluntary and pro-bono", diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx index 40440c1aa..c8fee82fe 100644 --- a/src/components/layout/Layout.tsx +++ b/src/components/layout/Layout.tsx @@ -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, @@ -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 ( - {title} + {metaTitle}