File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,12 @@ function toStr(children, counter = 0) {
7575 // Child is not a React element, append as-is
7676 const chunk = child . value . trim ( ) ;
7777 if ( chunk ) { result . push ( chunk ) ; }
78+ } else if (
79+ child . type === 'JSXExpressionContainer'
80+ && child . expression . type === 'StringLiteral'
81+ ) {
82+ const chunk = child . expression . value . trim ( ) ;
83+ if ( chunk ) { result . push ( chunk ) ; }
7884 } else {
7985 return [ [ ] , 0 ] ;
8086 }
Original file line number Diff line number Diff line change @@ -130,16 +130,10 @@ mix of text and React elements:
130130
131131``` javascript
132132< T >
133- A < button> button< / button> and a < b> bold< / b> walk into a bar
133+ A < button title = " button!!! " > button< / button> and a < b> bold< / b> walk into a bar
134134< / T >
135135```
136136
137- You must not inject any javascript code in the content of a T-component because:
138-
139- 1 . It will be rendered differently every time and the SDK won't be able to
140- predictably find a translation
141- 2 . The CLI will not be able to extract a source string from it
142-
143137If you do this, the string that will be sent to Transifex for translation will
144138look like this:
145139
@@ -151,6 +145,12 @@ As long as the translation respects the numbered tags, the T-component will
151145render the translation properly. Any props that the React elements have in the
152146source version of the text will be applied to the translation as well.
153147
148+ You must not inject any javascript code in the content of a T-component because:
149+
150+ 1 . It will be rendered differently every time and the SDK won't be able to
151+ predictably find a translation
152+ 2 . The CLI will not be able to extract a source string from it
153+
154154You can interpolate parameters as before, but you have to be careful with how
155155you define them in the source body:
156156
You can’t perform that action at this time.
0 commit comments