fix: set default locale for lang attribute
This commit is contained in:
parent
fd785ada56
commit
a87704cd05
@ -209,8 +209,7 @@ export function renderPage(
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const lang = componentData.frontmatter?.lang ?? cfg.locale.split("-")[0]
|
const lang = componentData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en"
|
||||||
|
|
||||||
const doc = (
|
const doc = (
|
||||||
<html lang={lang}>
|
<html lang={lang}>
|
||||||
<Head {...componentData} />
|
<Head {...componentData} />
|
||||||
|
@ -20,5 +20,6 @@ export const TRANSLATIONS = {
|
|||||||
"uk-UA": uk,
|
"uk-UA": uk,
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
export const i18n = (locale: ValidLocale): Translation => TRANSLATIONS[locale ?? "en-US"]
|
export const defaultTranslation = "en-US"
|
||||||
|
export const i18n = (locale: ValidLocale): Translation => TRANSLATIONS[locale ?? defaultTranslation]
|
||||||
export type ValidLocale = keyof typeof TRANSLATIONS
|
export type ValidLocale = keyof typeof TRANSLATIONS
|
||||||
|
Loading…
Reference in New Issue
Block a user