1681-engine / index / extractStrings
Function: extractStrings() ​
ts
function extractStrings(text, options?): ExtractedString[];Defined in: src/i18n/extractStrings.ts:26
Finds the strings passed to tr('…') (and trn('…', '…', n)) in a file's text, for a tool that lists keys missing from a catalog or drops unused ones. A plain scanner, not a parser: it reads a string literal straight after the call's parenthesis (quotes of any kind, escapes decoded) and skips a template literal with ${…} in it or a call whose key is not a literal, since neither can be a catalog key. A call inside a comment is still found.
Parameters ​
| Parameter | Type |
|---|---|
text | string |
options | ExtractOptions |