( messageParts: string[], placeholderNames: string[] = [], )
| 120 | * @param placeholderNames The names of the placeholders to intersperse between the `messageParts`. |
| 121 | */ |
| 122 | export function makeParsedTranslation( |
| 123 | messageParts: string[], |
| 124 | placeholderNames: string[] = [], |
| 125 | ): ParsedTranslation { |
| 126 | messageParts = messageParts.map((part) => part.replace(/\uFFFD/g, '')); |
| 127 | let messageString = messageParts[0]; |
| 128 | for (let i = 0; i < placeholderNames.length; i++) { |
| 129 | messageString += `{$${placeholderNames[i]}}${messageParts[i + 1]}`; |
| 130 | } |
| 131 | return { |
| 132 | text: messageString, |
| 133 | messageParts: makeTemplateObject(messageParts, messageParts), |
| 134 | placeholderNames, |
| 135 | }; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Create the specialized array that is passed to tagged-string tag functions. |
no test coverage detected