You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/translate.md
+50-1
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,11 @@ When you run the extraction tool, it creates the Intl API plural rules for each
94
94
}
95
95
}
96
96
```
97
-
There is no default value for `inlinePlural` function, so you must add the translation in each language, keeping in mind that the counter is optionally interpolated with the `value` parameter:
97
+
It is possible to set the default value passing a _valid stringified_ json, keeping in mind that the counter is optionally interpolated with the `value` parameter:
98
+
```tsx
99
+
p(1, 'devs@@{"one": "{{ value }} software developer","other": "{{ value }} software developers"}')
'{"one": "{{ value }} {{ color }} zebra","other": "{{ value }} {{ color }} zebras"}',
193
+
{
194
+
color: t('black and white')
195
+
}
196
+
)}</p>
197
+
</>
198
+
);
199
+
});
200
+
```
201
+
If you run the extractor, you will get json files like this:
202
+
```json
203
+
{
204
+
"app": {
205
+
"title": "Qwik Speak demo"
206
+
},
207
+
"autoKey_3c909eb27a10640be9495cff142f601c": {
208
+
"one": "{{ value }} {{ color }} zebra",
209
+
"other": "{{ value }} {{ color }} zebras"
210
+
},
211
+
"autoKey_8e4c0598319b3b04541df2fc36cb6fc5": "New strings without existing keys",
212
+
"autoKey_cbe370e60f10f92d4dd8b3e9c267b1fa": "black and white"
213
+
}
214
+
```
215
+
Then the Inline plugin will manage the self-assigned keys.
216
+
168
217
# Localize
169
218
## useFormatDate
170
219
`useFormatDate` returns a functions that uses [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) API to format dates:
0 commit comments