Skip to content

Commit aaa4c4b

Browse files
committed
translate: translations for signals tutorial
Fixes #167
1 parent 66757e4 commit aaa4c4b

24 files changed

Lines changed: 1406 additions & 308 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Learn Angular signals
2+
3+
This interactive tutorial will teach you the fundamentals of Angular signals and how to use them to build reactive applications.
4+
5+
## How to use this tutorial
6+
7+
This tutorial assumes you understand Angular's core concepts. If you're new to Angular, read our [essentials guide](/essentials).
8+
9+
Each step represents a concept in Angular signals. You can do one, or all of them.
10+
11+
If you get stuck, click "Reveal answer" at the top.
12+
13+
Alright, let's [get started](/tutorials/signals/1-creating-your-first-signal)!
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Learn Angular signals
1+
# Aprende sobre signals en Angular
22

3-
This interactive tutorial will teach you the fundamentals of Angular signals and how to use them to build reactive applications.
3+
Este tutorial interactivo te enseñará los fundamentos de los signals de Angular y cómo usarlos para construir aplicaciones reactivas.
44

5-
## How to use this tutorial
5+
## Cómo usar este tutorial
66

7-
This tutorial assumes you understand Angular's core concepts. If you're new to Angular, read our [essentials guide](/essentials).
7+
Este tutorial asume que entiendes los conceptos principales de Angular. Si eres nuevo en Angular, lee nuestra [guía esencial](/essentials).
88

9-
Each step represents a concept in Angular signals. You can do one, or all of them.
9+
Cada paso representa un concepto en los signals de Angular. Puedes hacer uno, o todos ellos.
1010

11-
If you get stuck, click "Reveal answer" at the top.
11+
Si te quedas atascado, haz clic en "Reveal answer" (Mostrar respuesta) en la parte superior.
1212

13-
Alright, let's [get started](/tutorials/signals/1-creating-your-first-signal)!
13+
Muy bien, ¡[comencemos](/tutorials/signals/1-creating-your-first-signal)!
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Creating and updating your first signal
2+
3+
Welcome to the Angular signals tutorial! [Signals](/essentials/signals) are Angular's reactive primitive that provide a way to manage state and automatically update your UI when that state changes.
4+
5+
In this activity, you'll learn how to:
6+
7+
- Create your first signal using the `signal()` function
8+
- Display its value in a template
9+
- Update the signal value using `set()` and `update()` methods
10+
11+
Let's build an interactive user status system with signals!
12+
13+
<hr />
14+
15+
<docs-workflow>
16+
17+
<docs-step title="Import the signal function">
18+
Import the `signal` function from `@angular/core` at the top of your component file.
19+
20+
```ts
21+
import {Component, signal, ChangeDetectionStrategy} from '@angular/core';
22+
```
23+
24+
</docs-step>
25+
26+
<docs-step title="Create a signal in your component">
27+
Add a `userStatus` signal to your component class that is initialized with a value of `'offline'`.
28+
29+
```ts
30+
@Component({
31+
/* Config omitted */
32+
})
33+
export class App {
34+
userStatus = signal<'online' | 'offline'>('offline');
35+
}
36+
```
37+
38+
</docs-step>
39+
40+
<docs-step title="Display the signal value in the template">
41+
Update the status indicator to display the current user status by:
42+
1. Binding the signal to the class attribute with `[class]="userStatus()"`
43+
2. Displaying the status text by replacing `???` with `{{ userStatus() }}`
44+
45+
```html
46+
<!-- Update from: -->
47+
<div class="status-indicator offline">
48+
<span class="status-dot"></span>
49+
Status: ???
50+
</div>
51+
52+
<!-- To: -->
53+
<div class="status-indicator" [class]="userStatus()">
54+
<span class="status-dot"></span>
55+
Status: {{ userStatus() }}
56+
</div>
57+
```
58+
59+
Notice how we call the signal `userStatus()` with parentheses to read its value.
60+
</docs-step>
61+
62+
<docs-step title="Add methods to update the signal">
63+
Add methods to your component that change the user status using the `set()` method.
64+
65+
```ts
66+
goOnline() {
67+
this.userStatus.set('online');
68+
}
69+
70+
goOffline() {
71+
this.userStatus.set('offline');
72+
}
73+
```
74+
75+
The `set()` method replaces the signal's value entirely with a new value.
76+
77+
</docs-step>
78+
79+
<docs-step title="Wire up the control buttons">
80+
The buttons are already in the template. Now connect them to your methods by adding:
81+
1. Click handlers with `(click)`
82+
2. Disabled states with `[disabled]` when already in that status
83+
84+
```html
85+
<!-- Add bindings to the existing buttons: -->
86+
<button (click)="goOnline()" [disabled]="userStatus() === 'online'">
87+
Go Online
88+
</button>
89+
<button (click)="goOffline()" [disabled]="userStatus() === 'offline'">
90+
Go Offline
91+
</button>
92+
```
93+
94+
</docs-step>
95+
96+
<docs-step title="Add a toggle method using update()">
97+
Add a `toggleStatus()` method that switches between online and offline using the `update()` method.
98+
99+
```ts
100+
toggleStatus() {
101+
this.userStatus.update(current => current === 'online' ? 'offline' : 'online');
102+
}
103+
```
104+
105+
The `update()` method takes a function that receives the current value and returns the new value. This is useful when you need to modify the existing value based on its current state.
106+
107+
</docs-step>
108+
109+
<docs-step title="Add the toggle button handler">
110+
The toggle button is already in the template. Connect it to your `toggleStatus()` method:
111+
112+
```html
113+
<button (click)="toggleStatus()" class="toggle-btn">
114+
Toggle Status
115+
</button>
116+
```
117+
118+
</docs-step>
119+
120+
</docs-workflow>
121+
122+
Congratulations! You've created your first signal and learned how to update it using both `set()` and `update()` methods. The `signal()` function creates a reactive value that Angular tracks, and when you update it, your UI automatically reflects the changes.
123+
124+
Next, you'll learn [how to derive state from signals using computed](/tutorials/signals/2-deriving-state-with-computed-signals)!
125+
126+
<docs-callout helpful title="About ChangeDetectionStrategy.OnPush">
127+
128+
You might notice `ChangeDetectionStrategy.OnPush` in the component decorator throughout this tutorial. This is a performance optimization for Angular components that use signals. For now, you can safely ignore it—just know it helps your app run faster when using signals! You can learn more in the [change detection strategies API docs](/api/core/ChangeDetectionStrategy).
129+
130+
</docs-callout>
Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
# Creating and updating your first signal
1+
# Creando y actualizando tu primer signal
22

3-
Welcome to the Angular signals tutorial! [Signals](/essentials/signals) are Angular's reactive primitive that provide a way to manage state and automatically update your UI when that state changes.
3+
¡Bienvenido al tutorial de signals de Angular! Los [signals](/essentials/signals) son la primitiva reactiva de Angular que proporciona una forma de gestionar estado y actualizar automáticamente tu UI cuando ese estado cambia.
44

5-
In this activity, you'll learn how to:
5+
En esta actividad, aprenderás cómo:
66

7-
- Create your first signal using the `signal()` function
8-
- Display its value in a template
9-
- Update the signal value using `set()` and `update()` methods
7+
- Crear tu primer signal usando la función `signal()`
8+
- Mostrar su valor en una plantilla
9+
- Actualizar el valor del signal usando los métodos `set()` y `update()`
1010

11-
Let's build an interactive user status system with signals!
11+
¡Construyamos un sistema interactivo de estado de usuario con signals!
1212

1313
<hr />
1414

1515
<docs-workflow>
1616

17-
<docs-step title="Import the signal function">
18-
Import the `signal` function from `@angular/core` at the top of your component file.
17+
<docs-step title="Importa la función signal">
18+
Importa la función `signal` desde `@angular/core` al inicio de tu archivo de componente.
1919

2020
```ts
2121
import {Component, signal, ChangeDetectionStrategy} from '@angular/core';
2222
```
2323

2424
</docs-step>
2525

26-
<docs-step title="Create a signal in your component">
27-
Add a `userStatus` signal to your component class that is initialized with a value of `'offline'`.
26+
<docs-step title="Crea un signal en tu componente">
27+
Agrega un signal `userStatus` a tu clase de componente que se inicialice con un valor de `'offline'`.
2828

2929
```ts
3030
@Component({
31-
/* Config omitted */
31+
/* Config omitida */
3232
})
3333
export class App {
3434
userStatus = signal<'online' | 'offline'>('offline');
@@ -37,30 +37,30 @@ export class App {
3737

3838
</docs-step>
3939

40-
<docs-step title="Display the signal value in the template">
41-
Update the status indicator to display the current user status by:
42-
1. Binding the signal to the class attribute with `[class]="userStatus()"`
43-
2. Displaying the status text by replacing `???` with `{{ userStatus() }}`
40+
<docs-step title="Muestra el valor del signal en la plantilla">
41+
Actualiza el indicador de estado para mostrar el estado actual del usuario:
42+
1. Vinculando el signal al atributo class con `[class]="userStatus()"`
43+
2. Mostrando el texto de estado reemplazando `???` con `{{ userStatus() }}`
4444

4545
```html
46-
<!-- Update from: -->
46+
<!-- Actualizar desde: -->
4747
<div class="status-indicator offline">
4848
<span class="status-dot"></span>
4949
Status: ???
5050
</div>
5151

52-
<!-- To: -->
52+
<!-- A: -->
5353
<div class="status-indicator" [class]="userStatus()">
5454
<span class="status-dot"></span>
5555
Status: {{ userStatus() }}
5656
</div>
5757
```
5858

59-
Notice how we call the signal `userStatus()` with parentheses to read its value.
59+
Observa cómo llamamos al signal `userStatus()` con paréntesis para leer su valor.
6060
</docs-step>
6161

62-
<docs-step title="Add methods to update the signal">
63-
Add methods to your component that change the user status using the `set()` method.
62+
<docs-step title="Agrega métodos para actualizar el signal">
63+
Agrega métodos a tu componente que cambien el estado del usuario usando el método `set()`.
6464

6565
```ts
6666
goOnline() {
@@ -72,17 +72,17 @@ goOffline() {
7272
}
7373
```
7474

75-
The `set()` method replaces the signal's value entirely with a new value.
75+
El método `set()` reemplaza el valor del signal completamente con un nuevo valor.
7676

7777
</docs-step>
7878

79-
<docs-step title="Wire up the control buttons">
80-
The buttons are already in the template. Now connect them to your methods by adding:
81-
1. Click handlers with `(click)`
82-
2. Disabled states with `[disabled]` when already in that status
79+
<docs-step title="Conecta los botones de control">
80+
Los botones ya están en la plantilla. Ahora conéctalos a tus métodos agregando:
81+
1. Manejadores de clic con `(click)`
82+
2. Estados deshabilitados con `[disabled]` cuando ya están en ese estado
8383

8484
```html
85-
<!-- Add bindings to the existing buttons: -->
85+
<!-- Agregar enlaces a los botones existentes: -->
8686
<button (click)="goOnline()" [disabled]="userStatus() === 'online'">
8787
Go Online
8888
</button>
@@ -93,21 +93,21 @@ The buttons are already in the template. Now connect them to your methods by add
9393

9494
</docs-step>
9595

96-
<docs-step title="Add a toggle method using update()">
97-
Add a `toggleStatus()` method that switches between online and offline using the `update()` method.
96+
<docs-step title="Agrega un método toggle usando update()">
97+
Agrega un método `toggleStatus()` que cambie entre online y offline usando el método `update()`.
9898

9999
```ts
100100
toggleStatus() {
101101
this.userStatus.update(current => current === 'online' ? 'offline' : 'online');
102102
}
103103
```
104104

105-
The `update()` method takes a function that receives the current value and returns the new value. This is useful when you need to modify the existing value based on its current state.
105+
El método `update()` toma una función que recibe el valor actual y devuelve el nuevo valor. Esto es útil cuando necesitas modificar el valor existente basado en su estado actual.
106106

107107
</docs-step>
108108

109-
<docs-step title="Add the toggle button handler">
110-
The toggle button is already in the template. Connect it to your `toggleStatus()` method:
109+
<docs-step title="Agrega el manejador del botón toggle">
110+
El botón toggle ya está en la plantilla. Conéctalo a tu método `toggleStatus()`:
111111

112112
```html
113113
<button (click)="toggleStatus()" class="toggle-btn">
@@ -119,12 +119,12 @@ The toggle button is already in the template. Connect it to your `toggleStatus()
119119

120120
</docs-workflow>
121121

122-
Congratulations! You've created your first signal and learned how to update it using both `set()` and `update()` methods. The `signal()` function creates a reactive value that Angular tracks, and when you update it, your UI automatically reflects the changes.
122+
¡Felicidades! Has creado tu primer signal y aprendido cómo actualizarlo usando los métodos `set()` y `update()`. La función `signal()` crea un valor reactivo que Angular rastrea, y cuando lo actualizas, tu UI refleja automáticamente los cambios.
123123

124-
Next, you'll learn [how to derive state from signals using computed](/tutorials/signals/2-deriving-state-with-computed-signals)!
124+
A continuación, aprenderás [cómo derivar estado de signals usando computed](/tutorials/signals/2-deriving-state-with-computed-signals)!
125125

126-
<docs-callout helpful title="About ChangeDetectionStrategy.OnPush">
126+
<docs-callout helpful title="Acerca de ChangeDetectionStrategy.OnPush">
127127

128-
You might notice `ChangeDetectionStrategy.OnPush` in the component decorator throughout this tutorial. This is a performance optimization for Angular components that use signals. For now, you can safely ignore it—just know it helps your app run faster when using signals! You can learn more in the [change detection strategies API docs](/api/core/ChangeDetectionStrategy).
128+
Puedes notar `ChangeDetectionStrategy.OnPush` en el decorador del componente a lo largo de este tutorial. Esta es una optimización de rendimiento para componentes Angular que usan signals. Por ahora, puedes ignorarlo de forma segura — solo debes saber que ayuda a tu aplicación a funcionar más rápido cuando usas signals. Puedes aprender más en la [documentación de la API de estrategias de detección de cambios](/api/core/ChangeDetectionStrategy).
129129

130130
</docs-callout>

0 commit comments

Comments
 (0)