fix: porblem with default locale

This commit is contained in:
Walid 2022-05-16 13:33:56 +01:00
parent e8655b3cfa
commit ffb1b83faf
No known key found for this signature in database
GPG Key ID: 7DF9215FC4E48853
3 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,4 @@
import Head from 'next/head' import Head from 'next/head'
import useTranslation from 'next-translate/useTranslation'
import { projectConfig } from 'utils/config' import { projectConfig } from 'utils/config'
@ -10,8 +9,6 @@ interface HeadProps {
const NextHead: React.FC<HeadProps> = (props) => { const NextHead: React.FC<HeadProps> = (props) => {
const { title = projectConfig.shortName } = props const { title = projectConfig.shortName } = props
const { lang } = useTranslation()
return ( return (
<Head> <Head>
<title>{title}</title> <title>{title}</title>
@ -43,7 +40,7 @@ const NextHead: React.FC<HeadProps> = (props) => {
<meta name='viewport' content='width=device-width, initial-scale=1.0' /> <meta name='viewport' content='width=device-width, initial-scale=1.0' />
<meta name='description' content={projectConfig.description} /> <meta name='description' content={projectConfig.description} />
<meta name='language' content={lang} /> <meta name='language' content={projectConfig.defaultLocale} />
<meta name='theme-color' content={projectConfig.color} /> <meta name='theme-color' content={projectConfig.color} />
<meta name='copyright' content={projectConfig.shortName} /> <meta name='copyright' content={projectConfig.shortName} />
<meta name='author' content={projectConfig.shortName} /> <meta name='author' content={projectConfig.shortName} />
@ -62,7 +59,9 @@ const NextHead: React.FC<HeadProps> = (props) => {
<meta property='og:description' content={projectConfig.description} /> <meta property='og:description' content={projectConfig.description} />
<meta <meta
property='og:locale' property='og:locale'
content={`${lang as string}_${lang.toUpperCase() as string}`} content={`${
projectConfig.defaultLocale
}_${projectConfig.defaultLocale.toUpperCase()}`}
/> />
<meta property='og:site_name' content={projectConfig.longName} /> <meta property='og:site_name' content={projectConfig.longName} />

View File

@ -1,4 +1,10 @@
type PCKeys = 'shortName' | 'longName' | 'description' | 'url' | 'color' type PCKeys =
| 'shortName'
| 'longName'
| 'description'
| 'url'
| 'color'
| 'defaultLocale'
type PCIconsKeys = 'default' | 'image' | 'apple' | '16_16' | '32_32' type PCIconsKeys = 'default' | 'image' | 'apple' | '16_16' | '32_32'
type PCProps = Record<PCKeys, string> type PCProps = Record<PCKeys, string>

View File

@ -6,6 +6,7 @@ export const projectConfig: PCDefaultValues = {
description: description:
'The latest Next.js boilerplate starter code/time saver with Typescript / SCSS. Including linters such as: Prettier, Eslint and Stylelint.', 'The latest Next.js boilerplate starter code/time saver with Typescript / SCSS. Including linters such as: Prettier, Eslint and Stylelint.',
url: 'Unknown project url', url: 'Unknown project url',
defaultLocale: 'en',
color: '#775aaa', color: '#775aaa',
icons: { icons: {
image: '/images/Logo.png', image: '/images/Logo.png',