-
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support providing a locale in
i18n.ts
instead of reading it f…
…rom the pathname (#1017)
- Loading branch information
Showing
68 changed files
with
1,842 additions
and
674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import cx from 'clsx'; | ||
import NextLink from 'next/link'; | ||
import {ReactNode} from 'react'; | ||
|
||
type Props = { | ||
children?: ReactNode; | ||
title: string; | ||
href: string; | ||
}; | ||
|
||
export default function Card({children, href, title, ...props}: Props) { | ||
return ( | ||
<NextLink | ||
className={cx( | ||
'group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200', | ||
'text-current no-underline dark:shadow-none', | ||
'hover:shadow-gray-100 dark:hover:shadow-none shadow-gray-100', | ||
'active:shadow-sm active:shadow-gray-200', | ||
'transition-all duration-200 hover:border-gray-300', | ||
'bg-transparent shadow-sm dark:border-neutral-800 hover:bg-slate-50 hover:shadow-md dark:hover:border-neutral-700 dark:hover:bg-neutral-900 p-4' | ||
)} | ||
href={href} | ||
{...props} | ||
> | ||
<span | ||
className={cx( | ||
'flex font-semibold items-start gap-2 text-gray-700 hover:text-gray-900', | ||
'dark:text-neutral-200 dark:hover:text-neutral-50 flex items-center' | ||
)} | ||
> | ||
{title} | ||
<span className="transition-transform duration-75 group-hover:translate-x-[2px]"> | ||
→ | ||
</span> | ||
</span> | ||
{children && <div className="mt-3">{children}</div>} | ||
</NextLink> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import cx from 'clsx'; | ||
import type {ComponentProps} from 'react'; | ||
|
||
type Props = ComponentProps<'div'>; | ||
|
||
export default function Cards({children, className, ...props}: Props) { | ||
return ( | ||
<div className={cx('flex flex-col gap-4', className)} {...props}> | ||
{children} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
export default function Logo() { | ||
return ( | ||
<svg | ||
aria-label="next-intl logo" | ||
className="h-8" | ||
viewBox="0 0 1663.8 399" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<g> | ||
<path | ||
d="M811.8,483V346.8c2-.8,6.4-1.7,13-2.7a164.81,164.81,0,0,1,23.9-1.5c8.6,0,15.8,1,21.5,3.1A28.62,28.62,0,0,1,884,356.1q5.25,7.2,7.5,18.6c1.5,7.6,2.2,16.9,2.2,27.9h0V483h19.5V396.3a131.41,131.41,0,0,0-3-29.1,61.1,61.1,0,0,0-10-22.7A45.29,45.29,0,0,0,881.3,330c-7.9-3.4-17.8-5.1-29.5-5.1q-21.3,0-36,3t-23.4,5.4h0V483Zm217.1,3.3a100.28,100.28,0,0,0,27.2-3.3c7.7-2.2,12.9-4.1,15.8-5.7h0l-3.6-16.8a105.18,105.18,0,0,1-13.5,5.1q-9.3,3-25.2,3-28.8,0-42-15.3t-14.1-43.8h108.9c.2-1.4.3-2.9.4-4.5s.2-3.2.2-4.8q0-38.7-17-57.3t-45.4-18.6a65.24,65.24,0,0,0-25,5A61.35,61.35,0,0,0,974,344.4a77.5,77.5,0,0,0-15.3,25.4c-3.9,10.1-5.8,22-5.8,35.5a119.68,119.68,0,0,0,4.2,32.6,66.21,66.21,0,0,0,13.5,25.6,62.29,62.29,0,0,0,23.7,16.8C1003.7,484.3,1015.3,486.3,1028.9,486.3Zm33.9-93.3H974a70.46,70.46,0,0,1,4-19.5,51.72,51.72,0,0,1,9.6-16.4,47.46,47.46,0,0,1,14.4-11.2,41,41,0,0,1,18.8-4.2q19.8,0,30.6,13.5t11.4,37.8Zm65.3,90c2.4-4.4,5.3-9.5,8.7-15.1s7.1-11.6,11.2-17.9,8.3-12.5,12.8-18.9,8.8-12.5,13.2-18.3c4.2,5.8,8.6,11.9,13.1,18.3s8.8,12.7,12.9,18.9,7.9,12.1,11.2,17.9,6.3,10.8,8.7,15.1h21c-3.8-7.4-8-14.9-12.5-22.5s-9.1-15-13.9-22-9.6-14-14.4-20.6-9.3-12.7-13.5-18.3h0l49.5-71.7h-21.3L1174,387.3l-40.2-59.4H1111l50.4,72.9q-14.1,19.2-27.6,39.2a474.65,474.65,0,0,0-25.8,43h20.1Zm195.2,3.3a72.65,72.65,0,0,0,22.8-3.4c7-2.3,11.9-4.4,14.7-6.1h0l-4.8-16.2a75.87,75.87,0,0,1-11.7,5.2c-5,1.8-11.6,2.9-19.8,2.9a54.4,54.4,0,0,1-13.2-1.5,20.45,20.45,0,0,1-10.2-6c-2.8-3-4.9-7.2-6.4-12.8s-2.2-12.6-2.2-21.5h0V344.4h61.8V327.9h-61.8V278.7l-19.5,3.6V425.1a132.63,132.63,0,0,0,2.4,27c1.6,7.6,4.3,13.9,8.2,19a34.92,34.92,0,0,0,15.6,11.4C1305.7,485,1313.7,486.3,1323.3,486.3Zm107.9-80.7V386.7h-67.8v18.9ZM1474,296.1a14.2,14.2,0,0,0,10.2-4.1c2.8-2.7,4.2-6.3,4.2-10.9s-1.4-8.2-4.2-11a14.11,14.11,0,0,0-10.2-4,14.53,14.53,0,0,0-10.2,4c-2.8,2.7-4.2,6.4-4.2,11s1.4,8.2,4.2,10.9A13.8,13.8,0,0,0,1474,296.1Zm9.9,186.9V327.9h-19.5V483Zm70.1,0V346.8c2-.8,6.3-1.7,13.1-2.7a163.34,163.34,0,0,1,23.8-1.5c8.6,0,15.8,1,21.4,3.1a28.62,28.62,0,0,1,13.8,10.4q5.25,7.2,7.5,18.6c1.5,7.6,2.2,16.9,2.2,27.9h0V483h19.5V396.3a131.41,131.41,0,0,0-3-29.1,58.17,58.17,0,0,0-10.1-22.7,45.29,45.29,0,0,0-18.9-14.5c-7.9-3.4-17.8-5.1-29.5-5.1q-21.3,0-36,3t-23.4,5.4h0V483Zm199.4,3.3a72.65,72.65,0,0,0,22.8-3.4c7-2.3,11.9-4.4,14.7-6.1h0l-4.8-16.2a75.87,75.87,0,0,1-11.7,5.2c-5,1.8-11.6,2.9-19.8,2.9a54.4,54.4,0,0,1-13.2-1.5,20.45,20.45,0,0,1-10.2-6c-2.8-3-4.9-7.2-6.4-12.8s-2.2-12.6-2.2-21.5h0V344.4h61.8V327.9h-61.8V278.7l-19.5,3.6V425.1a132.63,132.63,0,0,0,2.4,27c1.6,7.6,4.3,13.9,8.2,19a34.92,34.92,0,0,0,15.6,11.4C1735.8,485,1743.8,486.3,1753.4,486.3Zm105.2-.6,2.7-16.2a90.28,90.28,0,0,1-10.4-2.1,15.3,15.3,0,0,1-7-3.8,15.7,15.7,0,0,1-4.1-6.9,40.44,40.44,0,0,1-1.3-11.5h0v-195l-19.5,3.6v192c0,7.4.8,13.6,2.6,18.5a29.28,29.28,0,0,0,7.5,12,30.81,30.81,0,0,0,12.3,6.9,65.79,65.79,0,0,0,17.2,2.5Z" | ||
fill="currentColor" | ||
transform="translate(-197.5 -171.5)" | ||
/> | ||
<g> | ||
<path | ||
d="M528.8,509q-6.3,6-13.2,11.4a190,190,0,1,1,38-40.2" | ||
fill="none" | ||
stroke="#5fc3e7" | ||
strokeWidth="18" | ||
transform="translate(-197.5 -171.5)" | ||
/> | ||
<circle cx="329.2" cy="339.5" fill="#5fc3e7" r="9" /> | ||
<line | ||
fill="none" | ||
stroke="#5fc3e7" | ||
strokeLinecap="square" | ||
strokeWidth="18" | ||
x1="40" | ||
x2="353.5" | ||
y1="105" | ||
y2="105.5" | ||
/> | ||
<ellipse | ||
cx="202" | ||
cy="199.5" | ||
fill="none" | ||
rx="93.5" | ||
ry="190.5" | ||
stroke="#5fc3e7" | ||
strokeWidth="18" | ||
/> | ||
<line | ||
fill="none" | ||
stroke="#5fc3e7" | ||
strokeLinecap="square" | ||
strokeWidth="18" | ||
x1="49.5" | ||
x2="353.5" | ||
y1="304.5" | ||
y2="304.5" | ||
/> | ||
<line | ||
fill="none" | ||
stroke="#5fc3e7" | ||
strokeLinecap="square" | ||
strokeWidth="18" | ||
x1="9" | ||
x2="389" | ||
y1="206" | ||
y2="206" | ||
/> | ||
</g> | ||
</g> | ||
</svg> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 4 additions & 7 deletions
11
docs/pages/docs/environments/index.mdx → docs/pages/docs/environments.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
import {Card} from 'nextra-theme-docs'; | ||
import Card from 'components/Card'; | ||
import Cards from 'components/Cards'; | ||
|
||
# Environments | ||
|
||
The `next-intl` APIs are available in the following environments: | ||
|
||
<div className="mt-8 flex flex-col gap-4 md:w-2/3"> | ||
<Cards className="mt-8 lg:w-1/2"> | ||
<Card | ||
arrow | ||
title="Server & Client Components" | ||
href="/docs/environments/server-client-components" | ||
/> | ||
<Card | ||
arrow | ||
title="Metadata API & Route Handlers" | ||
href="/docs/environments/metadata-route-handlers" | ||
/> | ||
<Card | ||
arrow | ||
title="Error files (e.g. not-found)" | ||
href="/docs/environments/error-files" | ||
/> | ||
<Card | ||
arrow | ||
title="Core library (agnostic)" | ||
href="/docs/environments/core-library" | ||
/> | ||
</div> | ||
</Cards> | ||
|
||
While modern browsers and server runtimes typically support all necessary JavaScript APIs that are required for `next-intl`, you can double check [the runtime requirements](/docs/environments/runtime-requirements). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.