Skip to content

Commit 43e0532

Browse files
committed
translate: translations for extended diagnostics references
Fixes #129
1 parent 874daec commit 43e0532

34 files changed

+1482
-294
lines changed
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Defer Trigger Misconfiguration
2+
3+
This diagnostic detects unreachable or redundant triggers in `@defer` blocks.
4+
5+
```typescript
6+
7+
import {Component} from '@angular/core';
8+
9+
@Component({
10+
template: `
11+
@defer (on immediate; on timer(500ms)) {
12+
<large-component />
13+
}
14+
`
15+
})
16+
class MyComponent {}
17+
```
18+
19+
## What's wrong with that?
20+
21+
The diagnostic identifies several problematic patterns in defer trigger configuration that lead to:
22+
23+
- **Unnecessary code** that never affects behavior
24+
- **Missed optimization opportunities** for better performance
25+
- **Unreachable prefetch triggers** that will never execute
26+
27+
## Diagnostic warning cases
28+
29+
This diagnostic flags the following problematic patterns:
30+
31+
### `immediate` with prefetch triggers
32+
33+
**Bad — prefetch never runs**
34+
35+
```typescript
36+
@Component({
37+
template: `
38+
@defer (on immediate; prefetch on idle) {
39+
<my-cmp />
40+
}
41+
`
42+
})
43+
class MyComponent {}
44+
```
45+
46+
**Good — remove redundant prefetch**
47+
48+
```typescript
49+
@Component({
50+
template: `
51+
@defer (on immediate) {
52+
<my-cmp />
53+
}
54+
`
55+
})
56+
class MyComponent {}
57+
```
58+
59+
### Prefetch timer not earlier than main timer
60+
61+
**Bad — prefetch is later than main**
62+
63+
```typescript
64+
@Component({
65+
template: `
66+
@defer (on timer(100ms); prefetch on timer(3000ms)) {
67+
<my-cmp />
68+
}
69+
`
70+
})
71+
class MyComponent {}
72+
```
73+
74+
**Bad — equal timing provides no benefit**
75+
76+
```typescript
77+
@Component({
78+
template: `
79+
@defer (on timer(500ms); prefetch on timer(500ms)) {
80+
<my-cmp />
81+
}
82+
`
83+
})
84+
class MyComponent {}
85+
```
86+
87+
**Good — prefetch fires earlier**
88+
89+
```typescript
90+
@Component({
91+
template: `
92+
@defer (on timer(1000ms); prefetch on timer(500ms)) {
93+
<large-component />
94+
}
95+
`
96+
})
97+
class MyComponent {}
98+
```
99+
100+
### Identical prefetch and main triggers
101+
102+
**Bad — identical viewport trigger**
103+
104+
```typescript
105+
@Component({
106+
template: `
107+
@defer (on viewport; prefetch on viewport) {
108+
<my-cmp />
109+
}
110+
`
111+
})
112+
class MyComponent {}
113+
```
114+
115+
**Bad — identical interaction target**
116+
117+
```typescript
118+
@Component({
119+
template: `
120+
<button #loadBtn>Load</button>
121+
@defer (on interaction(loadBtn); prefetch on interaction(loadBtn)) {
122+
<large-component />
123+
}
124+
`
125+
})
126+
class MyComponent {}
127+
```
128+
129+
**Good — remove redundant prefetch**
130+
131+
```typescript
132+
@Component({
133+
template: `
134+
<button #loadBtn>Load</button>
135+
@defer (on interaction(loadBtn)) {
136+
<large-component />
137+
}
138+
`
139+
})
140+
class MyComponent {}
141+
```
142+
143+
**Good — use different targets for prefetch and main**
144+
145+
```typescript
146+
@Component({
147+
template: `
148+
<div #hoverArea>Hover to prefetch</div>
149+
<button #clickBtn>Click to load</button>
150+
@defer (on interaction(clickBtn); prefetch on hover(hoverArea)) {
151+
<large-component />
152+
}
153+
`
154+
})
155+
class MyComponent {}
156+
```
157+
158+
## Configuration requirements
159+
160+
[`strictTemplates`](tools/cli/template-typecheck#strict-mode) must be enabled for any extended diagnostic to emit.
161+
`deferTriggerMisconfiguration` has no additional requirements beyond `strictTemplates`.
162+
163+
## What if I can't avoid this?
164+
165+
This diagnostic can be disabled by editing the project's `tsconfig.json` file:
166+
167+
```json
168+
{
169+
"angularCompilerOptions": {
170+
"extendedDiagnostics": {
171+
"checks": {
172+
"deferTriggerMisconfiguration": "suppress"
173+
}
174+
}
175+
}
176+
}
177+
```
178+
179+
See [extended diagnostic configuration](extended-diagnostics#configuration) for more info.

adev-es/src/content/reference/extended-diagnostics/NG8021.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Defer Trigger Misconfiguration
1+
# Configuración incorrecta de disparadores de Defer
22

3-
This diagnostic detects unreachable or redundant triggers in `@defer` blocks.
3+
Este diagnóstico detecta disparadores inalcanzables o redundantes en bloques `@defer`.
44

55
```typescript
66

@@ -16,21 +16,21 @@ import {Component} from '@angular/core';
1616
class MyComponent {}
1717
```
1818

19-
## What's wrong with that?
19+
## ¿Qué está mal con eso?
2020

21-
The diagnostic identifies several problematic patterns in defer trigger configuration that lead to:
21+
El diagnóstico identifica varios patrones problemáticos en la configuración de disparadores de defer que conducen a:
2222

23-
- **Unnecessary code** that never affects behavior
24-
- **Missed optimization opportunities** for better performance
25-
- **Unreachable prefetch triggers** that will never execute
23+
- **Código innecesario** que nunca afecta el comportamiento
24+
- **Oportunidades de optimización perdidas** para un mejor rendimiento
25+
- **Disparadores de precarga inalcanzables** que nunca se ejecutarán
2626

27-
## Diagnostic warning cases
27+
## Casos de advertencia del diagnóstico
2828

29-
This diagnostic flags the following problematic patterns:
29+
Este diagnóstico marca los siguientes patrones problemáticos:
3030

31-
### `immediate` with prefetch triggers
31+
### `immediate` con disparadores de precarga
3232

33-
**Badprefetch never runs**
33+
**Incorrectola precarga nunca se ejecuta**
3434

3535
```typescript
3636
@Component({
@@ -43,7 +43,7 @@ This diagnostic flags the following problematic patterns:
4343
class MyComponent {}
4444
```
4545

46-
**Goodremove redundant prefetch**
46+
**Correctoelimina la precarga redundante**
4747

4848
```typescript
4949
@Component({
@@ -56,9 +56,9 @@ class MyComponent {}
5656
class MyComponent {}
5757
```
5858

59-
### Prefetch timer not earlier than main timer
59+
### Temporizador de precarga no anterior al temporizador principal
6060

61-
**Badprefetch is later than main**
61+
**Incorrectola precarga es posterior al principal**
6262

6363
```typescript
6464
@Component({
@@ -71,7 +71,7 @@ class MyComponent {}
7171
class MyComponent {}
7272
```
7373

74-
**Badequal timing provides no benefit**
74+
**Incorrectoel mismo tiempo no aporta ningún beneficio**
7575

7676
```typescript
7777
@Component({
@@ -84,7 +84,7 @@ class MyComponent {}
8484
class MyComponent {}
8585
```
8686

87-
**Goodprefetch fires earlier**
87+
**Correctola precarga se dispara antes**
8888

8989
```typescript
9090
@Component({
@@ -97,9 +97,9 @@ class MyComponent {}
9797
class MyComponent {}
9898
```
9999

100-
### Identical prefetch and main triggers
100+
### Disparadores de precarga y principal idénticos
101101

102-
**Badidentical viewport trigger**
102+
**Incorrectodisparador de viewport idéntico**
103103

104104
```typescript
105105
@Component({
@@ -112,7 +112,7 @@ class MyComponent {}
112112
class MyComponent {}
113113
```
114114

115-
**Badidentical interaction target**
115+
**Incorrectoobjetivo de interacción idéntico**
116116

117117
```typescript
118118
@Component({
@@ -126,7 +126,7 @@ class MyComponent {}
126126
class MyComponent {}
127127
```
128128

129-
**Goodremove redundant prefetch**
129+
**Correctoelimina la precarga redundante**
130130

131131
```typescript
132132
@Component({
@@ -140,7 +140,7 @@ class MyComponent {}
140140
class MyComponent {}
141141
```
142142

143-
**Gooduse different targets for prefetch and main**
143+
**Correctousa objetivos diferentes para la precarga y el principal**
144144

145145
```typescript
146146
@Component({
@@ -155,14 +155,14 @@ class MyComponent {}
155155
class MyComponent {}
156156
```
157157

158-
## Configuration requirements
158+
## Requisitos de configuración
159159

160-
[`strictTemplates`](tools/cli/template-typecheck#strict-mode) must be enabled for any extended diagnostic to emit.
161-
`deferTriggerMisconfiguration` has no additional requirements beyond `strictTemplates`.
160+
[`strictTemplates`](tools/cli/template-typecheck#strict-mode) debe estar habilitado para que se emita cualquier diagnóstico extendido.
161+
`deferTriggerMisconfiguration` no tiene requisitos adicionales más allá de `strictTemplates`.
162162

163-
## What if I can't avoid this?
163+
## ¿Qué pasa si no puedo evitar esto?
164164

165-
This diagnostic can be disabled by editing the project's `tsconfig.json` file:
165+
Este diagnóstico puede deshabilitarse editando el archivo `tsconfig.json` del proyecto:
166166

167167
```json
168168
{
@@ -176,4 +176,4 @@ This diagnostic can be disabled by editing the project's `tsconfig.json` file:
176176
}
177177
```
178178

179-
See [extended diagnostic configuration](extended-diagnostics#configuration) for more info.
179+
Consulta la [configuración de diagnósticos extendidos](extended-diagnostics#configuration) para más información.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Invalid Banana-in-Box
2+
3+
This diagnostic detects a backwards "banana-in-box" syntax for [two-way bindings](guide/templates/two-way-binding).
4+
5+
```
6+
7+
<user-viewer ([user])="loggedInUser" />
8+
```
9+
10+
## What's wrong with that?
11+
12+
As it stands, `([var])` is actually an [event binding](guide/templates/event-listeners) with the name `[var]`.
13+
The author likely intended this as a two-way binding to a variable named `var` but, as written, this binding has no effect.
14+
15+
## What should I do instead?
16+
17+
Fix the typo.
18+
As the name suggests, the banana `(` should go _inside_ the box `[]`.
19+
In this case:
20+
21+
```
22+
23+
<user-viewer [(user)]="loggedInUser" />
24+
```
25+
26+
## Configuration requirements
27+
28+
[`strictTemplates`](tools/cli/template-typecheck#strict-mode) must be enabled for any extended diagnostic to emit.
29+
`invalidBananaInBox` has no additional requirements beyond `strictTemplates`.
30+
31+
## What if I can't avoid this?
32+
33+
This diagnostic can be disabled by editing the project's `tsconfig.json` file:
34+
35+
```json
36+
37+
{
38+
"angularCompilerOptions": {
39+
"extendedDiagnostics": {
40+
"checks": {
41+
"invalidBananaInBox": "suppress"
42+
}
43+
}
44+
}
45+
}
46+
```
47+
48+
See [extended diagnostic configuration](extended-diagnostics#configuration) for more info.

0 commit comments

Comments
 (0)