Repository navigation
Commit b08de81
committed
refactor(@angular/build): add fast path for untranslated messages in i18n inliner worker
When inlining a locale without translations (such as the source locale or
when a translation dictionary is undefined), calls to translateMessage()
previously invoked ɵtranslate() with an empty dictionary. This caused
@angular/localize to throw a MissingTranslationError for every single
$localize message site in the application, catching it to retrieve the
original message parts from the parsed message.
Throwing and catching thousands of Error instances incurs significant V8
stack trace capturing and exception handling overhead.
translateMessage() now provides an early fast path when translations
is undefined: it directly calls ɵparseMessage(messageParts, substitutions)
to parse and strip metadata/placeholder markers without throwing or catching
exceptions.1 parent ce57763 commit b08de81
2 files changed
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
338 | | - | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
343 | 353 | | |
344 | 354 | | |
345 | 355 | | |
| |||
512 | 522 | | |
513 | 523 | | |
514 | 524 | | |
515 | | - | |
| 525 | + | |
516 | 526 | | |
517 | 527 | | |
518 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
139 | 153 | | |
140 | 154 | | |
141 | 155 | | |
| |||
0 commit comments