File tree 2 files changed +13
-7
lines changed
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) {
75
75
// Child is not a React element, append as-is
76
76
const chunk = child . value . trim ( ) ;
77
77
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 ) ; }
78
84
} else {
79
85
return [ [ ] , 0 ] ;
80
86
}
Original file line number Diff line number Diff line change @@ -130,16 +130,10 @@ mix of text and React elements:
130
130
131
131
``` javascript
132
132
< 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
134
134
< / T >
135
135
```
136
136
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
-
143
137
If you do this, the string that will be sent to Transifex for translation will
144
138
look like this:
145
139
@@ -151,6 +145,12 @@ As long as the translation respects the numbered tags, the T-component will
151
145
render the translation properly. Any props that the React elements have in the
152
146
source version of the text will be applied to the translation as well.
153
147
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
+
154
154
You can interpolate parameters as before, but you have to be careful with how
155
155
you define them in the source body:
156
156
You can’t perform that action at this time.
0 commit comments