diff --git a/next.config.js b/next.config.js index 7a4887fe..70eff04e 100755 --- a/next.config.js +++ b/next.config.js @@ -953,6 +953,10 @@ module.exports = withFonts( env: { FATHOM_ID: 'FOEMPXUV', }, + i18n: { + locales: ['en-US', 'es'], + defaultLocale: 'en-US', + }, redirects, rewrites, pageExtensions: ['js', 'ts', 'tsx', 'md', 'mdx'], diff --git a/src/common/constants.ts b/src/common/constants.ts index f6da9ec1..6eaa6938 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -4,4 +4,3 @@ export const CONTENT_MAX_WIDTH = 860; export const SHIKI_THEME = 'Material-Theme-Default'; export const THEME_STORAGE_KEY = 'theme'; export const STATUS_CHECKER_URL = 'https://status.test-blockstack.com'; -export const SUPPORTED_LANGUAGES = ['en']; diff --git a/src/components/header.tsx b/src/components/header.tsx index b2d1d1a7..82b45734 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -143,6 +143,7 @@ const NavItem: React.FC = ({ item, ...props }) => const { hover, active, bind } = useTouchable({ behavior: 'link', }); + return ( { }); const Header = ({ hideSubBar, ...rest }: any) => { + console.log('rest', useRouter().locale); return ( <> diff --git a/src/pages/_middleware.tsx b/src/pages/_middleware.tsx deleted file mode 100644 index e410a5c1..00000000 --- a/src/pages/_middleware.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server'; -import { SUPPORTED_LANGUAGES } from '../common/constants'; - -export function middleware(request: NextRequest) { - if (request.nextUrl.pathname.includes('/api/')) { - return undefined; - } - const shouldHandleLocale = - !request.nextUrl.pathname.includes('/favicon') && - !request.nextUrl.pathname.includes('/static/'); - - const locale = request.headers.get('accept-language').substr(0, 2); - if ((shouldHandleLocale && !SUPPORTED_LANGUAGES.includes(locale)) || locale === 'en') { - return undefined; - } else if (!request.nextUrl.pathname.includes(locale)) { - return NextResponse.redirect(`/${locale}${request.nextUrl.pathname}`); - } -}