Skip to content

Commit 3ce64f5

Browse files
committed
chore: update examples
1 parent 3010c67 commit 3ce64f5

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

example/src/App.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react'
2+
import { injectIntl, useIntl } from 'react-intl'
3+
4+
export const SubmitButton = injectIntl(({ intl }) => {
5+
const label = intl.formatMessage({
6+
id: 'App.submit',
7+
defaultMessage: 'Submit Button'
8+
})
9+
return <button aria-label={label}>{label}</button>
10+
})
11+
12+
export const HelloButton = () => {
13+
const intl = useIntl()
14+
const label = intl.formatMessage({
15+
id: 'App.hello',
16+
defaultMessage: 'Hello Button'
17+
})
18+
return <button aria-label={label}>{label}</button>
19+
}

example/src/messages.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
// eslint-disable-next-line import/no-extraneous-dependencies
2-
import { defineMessages, injectIntl } from 'react-intl'
3-
4-
export const SubmitButton = injectIntl(({ intl }) => {
5-
const label = intl.formatMessage({
6-
id: 'a.submit',
7-
defaultMessage: 'Submit Button'
8-
})
9-
return <button aria-label={label}>{label}</button>
10-
})
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
import { defineMessages } from 'react-intl'
113

124
export default defineMessages({
135
hello: {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"scripts": {
1616
"add-contributor": "all-contributors add",
1717
"fmt": "prettier --write '**/*.{json,js,md}'",
18-
"example": "./cli.js -l=en,ja -o example/i18n -d en 'example/**/*.js'",
18+
"example": "./cli.js -l=en,ja -o example/i18n -d en --extractFromFormatMessageCall=true 'example/**/*.{js,tsx}'",
1919
"build": "tsc",
2020
"lint": "eslint src/**/*.ts --fix --cache",
2121
"test": "npm run lint && jest"

0 commit comments

Comments
 (0)