Browse Source

translationfixes (#1311)

* translationfixes

* remove un-needed console log
functions-page-redirect
Jonathon Hammond 3 years ago
committed by GitHub
parent
commit
f52dd21fc4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      next.config.js
  2. 1
      src/common/constants.ts
  3. 1
      src/components/header.tsx
  4. 18
      src/pages/_middleware.tsx

4
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'],

1
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'];

1
src/components/header.tsx

@ -143,6 +143,7 @@ const NavItem: React.FC<FlexProps & { item: NavItem }> = ({ item, ...props }) =>
const { hover, active, bind } = useTouchable({
behavior: 'link',
});
return (
<Flex justifyContent="center" position="relative" {...props} {...bind}>
<HeaderTextItem

18
src/pages/_middleware.tsx

@ -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}`);
}
}
Loading…
Cancel
Save