Commit 2a4f582
fix(localize): use Object.hasOwn for placeholder lookup in translate
`translate()` looked up substitutions with `message.substitutions.hasOwnProperty(placeholder)`. A message whose placeholder is named `hasOwnProperty` stores that key on the plain substitutions object, shadowing the method, so the lookup calls the substitution value and throws a TypeError. Use `Object.hasOwn` instead, which resolves through `Object` and is unaffected by the shadowed key, matching the recent `I18nSelectPipe` fix.1 parent 12fe700 commit 2a4f582Copy full SHA for 2a4f582
2 files changed
+12-1Lines changed: 12 additions & 1 deletion
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/localize/src/utils
- src
- test
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/localize/src/utils/src/translations.ts
Copy file name to clipboardExpand all lines: packages/localize/src/utils/src/translations.ts+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | | - |
| 71 | + |
72 | 72 | |
73 | 73 | |
74 | 74 | |
|
Collapse file
packages/localize/src/utils/test/translations_spec.ts
Copy file name to clipboardExpand all lines: packages/localize/src/utils/test/translations_spec.ts+11Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
137 | 137 | |
138 | 138 | |
139 | 139 | |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
140 | 151 | |
141 | 152 | |
142 | 153 | |
|
0 commit comments