File tree Expand file tree Collapse file tree 5 files changed +25
-1
lines changed Expand file tree Collapse file tree 5 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export const SubmitButton = () => {
5151### Run Script
5252
5353```
54- $ extract-messages -l=en,ja -o app/translations -d en --flat false --extractFromFormatMessageCall=true 'app/**/!(*.test).js'
54+ $ extract-messages -l=en,ja -o app/translations -d en --flat false 'app/**/!(*.test).js'
5555```
5656
5757### Output
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ export default async (
9898 defaultLocale,
9999 withDescriptions : false ,
100100 cwd : process . cwd ( ) ,
101+ extractFromFormatMessageCall : true ,
101102 ...opts
102103 }
103104
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { useIntl } from 'react-intl'
3+
4+ export const SubmitButton = ( ) => {
5+ const intl = useIntl ( )
6+ const label = intl . formatMessage ( {
7+ id : 'a.submit' ,
8+ defaultMessage : 'Submit Button'
9+ } )
10+ return < button aria-label = { label } > { label } </ button >
11+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ exports[`export json - nest 1`] = `
44Object {
55 " a" : Object {
66 " hello" : " hello" ,
7+ " submit" : " Submit Button" ,
78 " world" : " world" ,
89 },
910 " b" : Object {
@@ -17,6 +18,7 @@ exports[`export json - nest 2`] = `
1718Object {
1819 " a" : Object {
1920 " hello" : " " ,
21+ " submit" : " " ,
2022 " world" : " " ,
2123 },
2224 " b" : Object {
@@ -29,6 +31,7 @@ Object {
2931exports [` export json 1` ] = `
3032Object {
3133 " a.hello" : " hello" ,
34+ " a.submit" : " Submit Button" ,
3235 " a.world" : " world" ,
3336 " b.hello" : " hello" ,
3437 " b.world" : " world" ,
@@ -38,6 +41,7 @@ Object {
3841exports [` export json 2` ] = `
3942Object {
4043 " a.hello" : " " ,
44+ " a.submit" : " " ,
4145 " a.world" : " " ,
4246 " b.hello" : " " ,
4347 " b.world" : " " ,
@@ -47,6 +51,7 @@ Object {
4751exports [` export json with removed messages 1` ] = `
4852Object {
4953 " a.hello" : " hello" ,
54+ " a.submit" : " Submit Button" ,
5055 " a.world" : " world" ,
5156 " b.hello" : " hello" ,
5257 " b.world" : " world" ,
@@ -56,6 +61,7 @@ Object {
5661exports [` export json with removed messages 2` ] = `
5762Object {
5863 " a.hello" : " " ,
64+ " a.submit" : " " ,
5965 " a.world" : " " ,
6066 " b.hello" : " " ,
6167 " b.world" : " " ,
Original file line number Diff line number Diff line change 33exports [` export yaml - flat 1` ] = `
44Object {
55 " a.hello" : " hello" ,
6+ " a.submit" : " Submit Button" ,
67 " a.world" : " world" ,
78 " b.hello" : " hello" ,
89 " b.world" : " world" ,
@@ -12,6 +13,7 @@ Object {
1213exports [` export yaml - flat 2` ] = `
1314Object {
1415 " a.hello" : " " ,
16+ " a.submit" : " " ,
1517 " a.world" : " " ,
1618 " b.hello" : " " ,
1719 " b.world" : " " ,
@@ -22,6 +24,7 @@ exports[`export yaml 1`] = `
2224Object {
2325 " a" : Object {
2426 " hello" : " hello" ,
27+ " submit" : " Submit Button" ,
2528 " world" : " world" ,
2629 },
2730 " b" : Object {
@@ -35,6 +38,7 @@ exports[`export yaml 2`] = `
3538Object {
3639 " a" : Object {
3740 " hello" : " " ,
41+ " submit" : " " ,
3842 " world" : " " ,
3943 },
4044 " b" : Object {
@@ -48,6 +52,7 @@ exports[`exsit yaml 1`] = `
4852Object {
4953 " a" : Object {
5054 " hello" : " hello" ,
55+ " submit" : " Submit Button" ,
5156 " world" : " world" ,
5257 },
5358 " b" : Object {
@@ -61,6 +66,7 @@ exports[`exsit yaml 2`] = `
6166Object {
6267 " a" : Object {
6368 " hello" : " hello2" ,
69+ " submit" : " " ,
6470 " world" : " " ,
6571 },
6672 " b" : Object {
You can’t perform that action at this time.
0 commit comments