Skip to content

Commit

Permalink
docs: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn authored Oct 28, 2024
1 parent 5b77396 commit 94245b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/use-intl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function UserProfile({user}) {
// en.json
{
"UserProfile": {
"title": "{username}'s profile",
"title": "{firstName}'s profile",
"membership": "Member since {memberSince, date, short}",
"followers": "{count, plural, ↵
=0 {No followers yet} ↵
Expand All @@ -60,21 +60,21 @@ import {IntlProvider, useTranslations} from 'use-intl';
// along with your app once you have the messages.
const messages = {
App: {
hello: 'Hello {username}!'
hello: 'Hello {firstName}!'
}
};

function Root() {
return (
<IntlProvider messages={messages} locale="en">
<App user={{name: 'Jane'}} />
<App user={{firstName: 'Jane'}} />
</IntlProvider>
);
}

function App({user}) {
const t = useTranslations('App');
return <h1>{t('hello', {username: user.name})}</h1>;
return <h1>{t('hello', {firstName: user.firstName})}</h1>;
}
```

Expand Down

0 comments on commit 94245b2

Please sign in to comment.