Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add i18n to docs #885

Merged
merged 19 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
06c9a86
chore: add projects to showcase
tobySolutions Dec 24, 2023
83a3439
Merge branch 'main' of /~https://github.com/aidenybai/million
tobySolutions Jan 7, 2024
e34644c
chore: checkout to new branch
tobySolutions Jan 7, 2024
ac527f6
Merge branch 'main' of /~https://github.com/aidenybai/million
tobySolutions Jan 7, 2024
3c97865
Merge branch 'main' of /~https://github.com/aidenybai/million
tobySolutions Jan 7, 2024
d6467de
Merge branch 'main' of /~https://github.com/aidenybai/million
tobySolutions Jan 7, 2024
d685542
Merge branch 'main' of /~https://github.com/aidenybai/million
tobySolutions Jan 10, 2024
ed9ca86
Merge branch 'main' of /~https://github.com/aidenybai/million
tobySolutions Jan 17, 2024
f132dc0
feat/add-i18n-to-docs
tobySolutions Jan 18, 2024
c062cc4
feat(docs): add i18n support
tobySolutions Jan 18, 2024
ffa354c
chore: checkout
tobySolutions Jan 20, 2024
19cc44f
test i18n at top level (#887)
Jan 20, 2024
553f601
chore: pulling
tobySolutions Jan 20, 2024
da69a0e
chore(i18n): create translations scaffold for pages and docs
tobySolutions Jan 20, 2024
23c2a57
Merge branch 'main' of /~https://github.com/aidenybai/million into feat…
tobySolutions Jan 20, 2024
e5db427
chore(i18n): create translations scaffold for blogs
tobySolutions Jan 21, 2024
8c8707e
chore(i18n): fix 404 for AI page
tobySolutions Jan 21, 2024
557eaec
chore(i18n): fix 404 for AI page
tobySolutions Jan 21, 2024
6871db5
chore: remove other languages from toggler temporarilt
tobySolutions Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/components/home/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function Hero() {
!
</p>
<div className="mt-16 flex flex-wrap justify-center gap-y-4 gap-x-6">
<Link href="/docs" className="w-full sm:w-max">
<Link href="/docs/introduction" className="w-full sm:w-max">
<ShimmerButton
className="relative w-full sm:w-max flex items-center justify-center transition-all hover:shadow-[0_0_0_3px_rgba(255,255,255,0.3)_inset]"
background="radial-gradient(ellipse 80% 70% at 50% 120%, #b28ce2, #892fda)"
Expand Down
12 changes: 12 additions & 0 deletions website/middleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { locales } from 'nextra/locales';

export const middleware = (request) => {
const { nextUrl } = request;

// The middleware must not handle dynamic routes.
// if (nextUrl.pathname.startsWith('/ai')) {
// return;
// }

return locales(request);
};
13 changes: 13 additions & 0 deletions website/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ const withNextra = nextra({
*/
const nextConfig = {
transpilePackages: ['react-tweet'],
i18n: {
locales: ['en-US', 'zh-CN', 'es-ES', "fr-FR"],
defaultLocale: 'en-US',
},
async redirects() {
return [
{
source: '/docs.([a-zA-Z-]+)',
destination: '/docs/introduction',
statusCode: 302,
}
];
},
};

// eslint-disable-next-line import/no-default-export -- Next.js requires default export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
}
}
}
}
}
73 changes: 73 additions & 0 deletions website/pages/_meta.es-ES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"index": {
"type": "page",
"title": "Million.js",
"display": "hidden",
"theme": {
"layout": "raw"
}
},
"docs": {
"type": "page",
"title": "Docs"
},
"blog": {
"type": "page",
"title": "Blog"
},
"showcase": {
"type": "page",
"title": "Showcase",
"theme": {
"typesetting": "article",
"layout": "full"
}
},
"foundation": {
"display": "hidden",
"type": "page",
"title": "Foundation",
"theme": {
"typesetting": "article"
}
},
"faq": {
"type": "page",
"title": "FAQ",
"theme": {
"layout": "raw"
}
},
"ai": {
"type": "page",
"title": "AI",
"theme": {
"layout": "raw"
}
},
"more": {
"title": "More",
"type": "menu",
"items": {
"foundation": {
"title": "Foundation",
"href": "/foundation"
},
"research": {
"title": "Research",
"href": "https://dl.acm.org/doi/10.1145/3555776.3577683",
"newWindow": true
},
"demo": {
"title": "Live demo",
"href": "https://demo.million.dev",
"newWindow": true
},
"hundred": {
"title": "Build your own",
"href": "/~https://github.com/aidenybai/hundred",
"newWindow": true
}
}
}
}
73 changes: 73 additions & 0 deletions website/pages/_meta.fr-FR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"index": {
"type": "page",
"title": "Million.js",
"display": "hidden",
"theme": {
"layout": "raw"
}
},
"docs": {
"type": "page",
"title": "Docs"
},
"blog": {
"type": "page",
"title": "Blog"
},
"showcase": {
"type": "page",
"title": "Showcase",
"theme": {
"typesetting": "article",
"layout": "full"
}
},
"foundation": {
"display": "hidden",
"type": "page",
"title": "Foundation",
"theme": {
"typesetting": "article"
}
},
"faq": {
"type": "page",
"title": "FAQ",
"theme": {
"layout": "raw"
}
},
"ai": {
"type": "page",
"title": "AI",
"theme": {
"layout": "raw"
}
},
"more": {
"title": "More",
"type": "menu",
"items": {
"foundation": {
"title": "Foundation",
"href": "/foundation"
},
"research": {
"title": "Research",
"href": "https://dl.acm.org/doi/10.1145/3555776.3577683",
"newWindow": true
},
"demo": {
"title": "Live demo",
"href": "https://demo.million.dev",
"newWindow": true
},
"hundred": {
"title": "Build your own",
"href": "/~https://github.com/aidenybai/hundred",
"newWindow": true
}
}
}
}
73 changes: 73 additions & 0 deletions website/pages/_meta.zh-CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"index": {
"type": "page",
"title": "Million.js",
"display": "hidden",
"theme": {
"layout": "raw"
}
},
"docs": {
"type": "page",
"title": "Docs"
},
"blog": {
"type": "page",
"title": "Blog"
},
"showcase": {
"type": "page",
"title": "Showcase",
"theme": {
"typesetting": "article",
"layout": "full"
}
},
"foundation": {
"display": "hidden",
"type": "page",
"title": "Foundation",
"theme": {
"typesetting": "article"
}
},
"faq": {
"type": "page",
"title": "FAQ",
"theme": {
"layout": "raw"
}
},
"ai": {
"type": "page",
"title": "AI",
"theme": {
"layout": "raw"
}
},
"more": {
"title": "More",
"type": "menu",
"items": {
"foundation": {
"title": "Foundation",
"href": "/foundation"
},
"research": {
"title": "Research",
"href": "https://dl.acm.org/doi/10.1145/3555776.3577683",
"newWindow": true
},
"demo": {
"title": "Live demo",
"href": "https://demo.million.dev",
"newWindow": true
},
"hundred": {
"title": "Build your own",
"href": "/~https://github.com/aidenybai/hundred",
"newWindow": true
}
}
}
}
File renamed without changes.
8 changes: 8 additions & 0 deletions website/pages/ai.es-ES.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: 'Million AI'
description: 'Your personal performance expert'
---

import { Home } from '../components/ai';

<Home />
8 changes: 8 additions & 0 deletions website/pages/ai.fr-FR.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: 'Million AI'
description: 'Your personal performance expert'
---

import { Home } from '../components/ai';

<Home />
8 changes: 8 additions & 0 deletions website/pages/ai.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: 'Million AI'
description: 'Your personal performance expert'
---

import { Home } from '../components/ai';

<Home />
File renamed without changes.
58 changes: 58 additions & 0 deletions website/pages/blog.es-ES.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Blog
description: The latest updates and releases from the Million.js team.
---

import { getPagesUnderRoute } from 'nextra/context';
import Link from 'next/link';

export function BlogHeader() {
return (
<div className="max-w-screen-lg mx-auto pt-4 pb-8 mb-16 border-b border-gray-400 border-opacity-20 text-center">
<h1>
<span className="font-bold leading-tight lg:text-5xl">Blog</span>
</h1>
<p className="text-center text-gray-500 dark:text-gray-400 font-space-grotesk">
The latest updates and releases from the Million.js team.
</p>
</div>
);
}

export function BlogIndex() {
return getPagesUnderRoute('/blog')
.sort((a, b) => {
return (
new Date(b.frontMatter?.date || 0).getTime() -
new Date(a.frontMatter?.date || 0).getTime()
);
})
.map((page) => {
return (
<div key={page.route} className="mb-10">
<Link
href={page.route}
style={{ color: 'inherit', textDecoration: 'none' }}
className="block font-semibold mt-8 text-2xl"
tabIndex="0"
>
{page.meta?.title || page.frontMatter?.title || page.name}
</Link>
<p className="opacity-80" style={{ marginTop: '.5rem' }}>
{page.frontMatter?.description}{' '}
<span className="inline-block nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font] font-bold">
<Link href={page.route} tabIndex="-1">
{'Read more →'}
</Link>
</span>
</p>
{page.frontMatter?.date ? (
<p className="opacity-50 text-sm mt-2">{page.frontMatter.date}</p>
) : null}
</div>
);
});
}

<BlogHeader />
<BlogIndex />
Loading
Loading