Skip to content

Commit

Permalink
docs: Latest RSC beta and wording improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Sep 14, 2023
1 parent 080bbee commit 5d00838
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
24 changes: 12 additions & 12 deletions docs/components/CodeSnippets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,39 +336,39 @@ function buildOutput() {
<span className="line"> </span>
<span className="line">
<span style={{color: 'var(--shiki-token-comment)'}}>
Route{' '}Size{' '}First load JS
Route{' '}Size{' '}First load JS
</span>
</span>
<span className="line">
<span style={{color: 'var(--shiki-color-text)'}}>┌ ● /</span>
<span style={{color: 'var(--shiki-color-text)'}}> </span>
<span style={{color: 'var(--shiki-color-text)'}}>
{' '}637
{' '}1.4
</span>
<span style={{color: 'var(--shiki-color-text)'}}> B</span>
<span style={{color: 'var(--shiki-color-text)'}}>{' '}</span>
<span style={{color: 'var(--shiki-color-text)'}}> kB</span>
<span style={{color: 'var(--shiki-color-text)'}}>{' '}</span>
<span style={{color: 'var(--shiki-token-string-expression)'}}>
90.1 kB
104 kB
</span>
</span>
<span className="line">
<span style={{color: 'var(--shiki-color-text)'}}>├ ● /about</span>
<span style={{color: 'var(--shiki-color-text)'}}>{' '}</span>
<span style={{color: 'var(--shiki-color-text)'}}>512</span>
<span style={{color: 'var(--shiki-color-text)'}}>205</span>
<span style={{color: 'var(--shiki-color-text)'}}> B</span>
<span style={{color: 'var(--shiki-color-text)'}}>{' '}</span>
<span style={{color: 'var(--shiki-color-text)'}}>{' '}</span>
<span style={{color: 'var(--shiki-token-string-expression)'}}>
92.5 kB
97.5 kB
</span>
</span>
<span className="line">
<span style={{color: 'var(--shiki-color-text)'}}> /contact</span>
<span style={{color: 'var(--shiki-color-text)'}}>λ /contact</span>
<span style={{color: 'var(--shiki-color-text)'}}>{' '}</span>
<span style={{color: 'var(--shiki-color-text)'}}>931</span>
<span style={{color: 'var(--shiki-color-text)'}}> B</span>
<span style={{color: 'var(--shiki-color-text)'}}>3.24</span>
<span style={{color: 'var(--shiki-color-text)'}}> kB</span>
<span style={{color: 'var(--shiki-color-text)'}}>{' '}</span>
<span style={{color: 'var(--shiki-token-string-expression)'}}>
91.2 kB
106 kB
</span>
</span>
<span className="line"> </span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Next.js 13 introduces support for [React Server Components](https://nextjs.org/d
## Current beta version

```
npm install [email protected].16
npm install [email protected].17
```

This beta version was tested with `[email protected]`.
Expand Down
16 changes: 15 additions & 1 deletion docs/pages/docs/usage/messages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,25 @@ As your app grows, you'll want to reuse messages among your components. If you u

**Examples:**

- You're displaying products in your app and often need to resolve a category identifier to a human readable label (e.g. `new` → "Just in"). To ensure consistency, you can add a `ProductCategory` component that turns the `category` into a string.
- You're displaying products in your app and often need to resolve a category identifier to a human readable label (e.g. `new` → "Just in"). To ensure consistency, you can add a `ProductCategory` component that turns the `category` into a styled badge.
- You commonly need a dialog that displays a "confirm" and "cancel" button. In this case, consider adding a `ConfirmDialog` component to reuse the messages along with the functionality.

There might be cases where you want to use the same message in different components, but there's no reasonable opportunity for sharing the message via a component. This might be symptom that these components should use separate messages, even if they happen to be the same for the time being. By using separate labels, you gain the flexibility to use more specific labels (e.g. "not now" instead of "cancel").

For edge cases where the reuse of messages among different components is hard to achieve with shared components, you can consider adding a hook that shares the translation behavior:

```tsx filename="useLocaleLabel.tsx"
export default function useLocaleLabel() {
const t = useLocaleLabel('useLocaleLabel');

function getLocaleLabel(locale: 'en' | 'de') {
return t('label', {locale});
}

return getLocaleLabel;
}
```

</details>

<details>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ import UserTestimonial from 'components/UserTestimonial';
/>
<FeaturePanel
code={<CodeSnippets.buildOutput />}
title="Static & dynamic rendering"
description="Get the best performance from your app by supporting internationalization on both static and dynamic pages."
title="Performance-obsessed, and Next.js-native"
description="Use static or dynamic rendering, Server or Client Components, and App or Pages Router."
/>
<FeaturePanel
code={<CodeSnippets.standards />}
Expand Down

2 comments on commit 5d00838

@vercel
Copy link

@vercel vercel bot commented on 5d00838 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-intl-example-next-13 – ./examples/example-next-13

next-intl-example-next-13-git-main-next-intl.vercel.app
next-intl-example-next-13-next-intl.vercel.app
next-intl-example-next-13.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 5d00838 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-intl-docs – ./docs

next-intl-docs.vercel.app
next-intl-docs-git-main-next-intl.vercel.app
next-intl-docs-next-intl.vercel.app

Please sign in to comment.