Adjust html lang attribute, standard i18n capitalization
This commit is contained in:
parent
ebdcbb8923
commit
bc7fc198c0
12
README.md
12
README.md
@ -264,12 +264,12 @@ Vercel Postgres can be switched to another Postgres-compatible, pooling provider
|
|||||||
Partial internationalization (for non-admin, user-facing text) provided for a handful of languages. Configure locale by setting environment variable `NEXT_PUBLIC_LOCALE`.
|
Partial internationalization (for non-admin, user-facing text) provided for a handful of languages. Configure locale by setting environment variable `NEXT_PUBLIC_LOCALE`.
|
||||||
|
|
||||||
### Supported Languages
|
### Supported Languages
|
||||||
- `US_EN`
|
- `us-en`
|
||||||
- `ES_ES` (coming soon)
|
- `es-es` (coming soon)
|
||||||
- `PT_BR`
|
- `pt-br`
|
||||||
- `PT_PT`
|
- `pt-pt`
|
||||||
- `ID_ID`
|
- `id-id`
|
||||||
- `ZH_CN`
|
- `zh-cn`
|
||||||
|
|
||||||
To add support for a new language, open a PR following instructions in [/src/i18n/index.ts](https://github.com/sambecker/exif-photo-blog/blob/main/src/i18n/index.ts), using [`US_EN`](https://github.com/sambecker/exif-photo-blog/blob/main/src/i18n/locales/us-en.ts) as reference.
|
To add support for a new language, open a PR following instructions in [/src/i18n/index.ts](https://github.com/sambecker/exif-photo-blog/blob/main/src/i18n/index.ts), using [`US_EN`](https://github.com/sambecker/exif-photo-blog/blob/main/src/i18n/locales/us-en.ts) as reference.
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import {
|
|||||||
META_DESCRIPTION,
|
META_DESCRIPTION,
|
||||||
NAV_TITLE_OR_DOMAIN,
|
NAV_TITLE_OR_DOMAIN,
|
||||||
META_TITLE,
|
META_TITLE,
|
||||||
|
HTML_LANG,
|
||||||
} from '@/app/config';
|
} from '@/app/config';
|
||||||
import AppStateProvider from '@/state/AppStateProvider';
|
import AppStateProvider from '@/state/AppStateProvider';
|
||||||
import ToasterWithThemes from '@/toast/ToasterWithThemes';
|
import ToasterWithThemes from '@/toast/ToasterWithThemes';
|
||||||
@ -72,7 +73,7 @@ export default function RootLayout({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<html
|
<html
|
||||||
lang="en"
|
lang={HTML_LANG}
|
||||||
// Suppress hydration errors due to next-themes behavior
|
// Suppress hydration errors due to next-themes behavior
|
||||||
suppressHydrationWarning
|
suppressHydrationWarning
|
||||||
>
|
>
|
||||||
|
|||||||
@ -294,7 +294,7 @@ export default function AdminAppConfigurationClient({
|
|||||||
icon={<BiPencil size={16} />}
|
icon={<BiPencil size={16} />}
|
||||||
>
|
>
|
||||||
<ChecklistRow
|
<ChecklistRow
|
||||||
title={`Configure language: ${locale.toLocaleUpperCase()}`}
|
title={`Configure language: ${locale}`}
|
||||||
status={hasLocale}
|
status={hasLocale}
|
||||||
optional
|
optional
|
||||||
>
|
>
|
||||||
|
|||||||
@ -101,7 +101,11 @@ const SITE_DOMAIN_SHORT = shortenUrl(SITE_DOMAIN);
|
|||||||
|
|
||||||
// SITE META
|
// SITE META
|
||||||
|
|
||||||
export const APP_LOCALE = process.env.NEXT_PUBLIC_LOCALE || 'US-EN';
|
export const APP_LOCALE = (process.env.NEXT_PUBLIC_LOCALE || 'us-en')
|
||||||
|
// Accepts both `us-en` and `US_EN`
|
||||||
|
.toLocaleLowerCase()
|
||||||
|
.replace('_', '-');
|
||||||
|
export const HTML_LANG = (APP_LOCALE.split('-')[1] || 'en');
|
||||||
|
|
||||||
export const NAV_TITLE =
|
export const NAV_TITLE =
|
||||||
process.env.NEXT_PUBLIC_NAV_TITLE;
|
process.env.NEXT_PUBLIC_NAV_TITLE;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user