@alia.onl/sdk 21.3.0 → 21.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @alia.onl/sdk
2
2
 
3
+ ## 21.3.1
4
+
5
+ - Ask Alia follows the active account language resolved by Oxy Services instead of defaulting to
6
+ English. Changes to that language update the open sheet without replacing its conversation.
7
+ - Ship a complete Spanish chat catalogue, including composer, voice, menus, thought panel and
8
+ conversation errors. Regional Spanish tags use it; host label overrides remain supported.
9
+ - Apply the sheet's labels above its hooks and all its sheets, so sharing errors and the thought
10
+ panel use the same language as the conversation.
11
+
3
12
  ## 21.3.0
4
13
 
5
14
  The SDK runs on Expo SDK 58 (React Native 0.88, React 19.3) as well as Expo 57.
package/README.md CHANGED
@@ -56,9 +56,12 @@ The empty chat greets the signed-in person by name ("Hi Nate, what's on your min
56
56
  Failures (a voice call that cannot start, a dictation error) are shown with Bloom's `toast`,
57
57
  so the app needs a `ToastOutlet` (`OxyProvider` mounts one), or pass `onError` to handle them.
58
58
 
59
- The chat's own copy is English. Pass `labels` to `AliaChatSheet` or
60
- `AliaChatScreen` to translate it (`AliaChatLabels`; anything omitted stays
61
- English). Bloom's own strings follow `BloomProvider`'s `locale`.
59
+ `AliaAskProvider` follows the language Oxy Services resolves for the active account, including
60
+ language changes while its sheet is open. The SDK ships English and Spanish (regional Spanish tags
61
+ such as `es-ES` and `es-MX` use Spanish); other languages fall back to English. `AliaChatSheet` and
62
+ `AliaChatScreen` select their built-in copy from `labels.locale`. Pass `labels` to override any copy
63
+ (`AliaChatLabels`), or `labels.t` for another catalogue. Nested overrides preserve the surrounding
64
+ chat's translations. Bloom's own strings follow `BloomProvider`'s `locale`.
62
65
 
63
66
  Entry points:
64
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alia.onl/sdk",
3
- "version": "21.3.0",
3
+ "version": "21.3.1",
4
4
  "description": "Alia AI chat SDK — the conversation runtime, chat UI, voice calls and dictation for Oxy apps",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -12,7 +12,7 @@
12
12
  * does not wait on the network.
13
13
  */
14
14
 
15
- import { useAuth } from '@oxy.so/services/ui/client';
15
+ import { useAuth, useOxy } from '@oxy.so/services/ui/client';
16
16
  import {
17
17
  createContext,
18
18
  forwardRef,
@@ -95,10 +95,15 @@ interface Opening extends AliaAskOpening {
95
95
  * configures the sheet and so sits above it — a host-tool executor that closes it.
96
96
  */
97
97
  export const AliaAskProvider = forwardRef<AliaAsk, AliaAskProviderProps>(function AliaAskProvider(
98
- { agents, welcomeSuggestions, children, ...sheet },
98
+ { agents, welcomeSuggestions, children, labels, ...sheet },
99
99
  ref,
100
100
  ) {
101
101
  const { canUsePrivateApi, signIn } = useAuth();
102
+ const { currentLanguage } = useOxy();
103
+ const localizedLabels = useMemo(
104
+ () => ({ ...labels, locale: labels?.locale ?? currentLanguage }),
105
+ [labels, currentLanguage],
106
+ );
102
107
  const sheetRef = useRef<AliaChatSheetRef>(null);
103
108
  const [opening, setOpening] = useState<Opening | null>(null);
104
109
  const [current, setCurrent] = useState<string | undefined>(undefined);
@@ -156,6 +161,7 @@ export const AliaAskProvider = forwardRef<AliaAsk, AliaAskProviderProps>(functio
156
161
  key={agentId ?? 'alia'}
157
162
  ref={sheetRef}
158
163
  {...sheet}
164
+ labels={localizedLabels}
159
165
  agent={agent}
160
166
  welcomeSuggestions={agent === undefined ? welcomeSuggestions : undefined}
161
167
  // A different agent is a new sheet: the opening waits for that one to mount.
@@ -16,7 +16,7 @@ import { useSharedValue } from 'react-native-reanimated';
16
16
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
17
17
  import { BREAKPOINTS } from '@oxy.so/bloom/styles';
18
18
  import { ALIA_CHARACTER_RUNTIME_URL } from '../lib/character-runtime';
19
- import type { AliaChatLabels } from '../lib/labels';
19
+ import { AliaChatLabelsProvider, type AliaChatLabels } from '../lib/labels';
20
20
  import type { AliaToolRenderers } from '../lib/tool-renderers';
21
21
  import { useShareHandler } from '../hooks/useShareHandler';
22
22
  import type { AliaRuntimeHost } from '../runtime/config';
@@ -109,6 +109,16 @@ export interface AliaChatSheetRef {
109
109
  }
110
110
 
111
111
  export const AliaChatSheet = forwardRef<AliaChatSheetRef, AliaChatSheetProps>(
112
+ function AliaChatSheet(props, ref) {
113
+ return (
114
+ <AliaChatLabelsProvider labels={props.labels}>
115
+ <AliaChatSheetBody {...props} ref={ref} />
116
+ </AliaChatLabelsProvider>
117
+ );
118
+ },
119
+ );
120
+
121
+ const AliaChatSheetBody = forwardRef<AliaChatSheetRef, AliaChatSheetProps>(
112
122
  (
113
123
  {
114
124
  agent,
@@ -0,0 +1,280 @@
1
+ /** The SDK chat catalogue, matching the Spanish Alia app copy. */
2
+ import type { CopyEntry } from './copy-en';
3
+
4
+ export const COPY_ES: Readonly<Record<string, CopyEntry>> = {
5
+ 'automations.cron.dailyAt': 'Todos los días a las {{time}}',
6
+ 'automations.cron.dayPlural.0': 'domingos',
7
+ 'automations.cron.dayPlural.1': 'lunes',
8
+ 'automations.cron.dayPlural.2': 'martes',
9
+ 'automations.cron.dayPlural.3': 'miércoles',
10
+ 'automations.cron.dayPlural.4': 'jueves',
11
+ 'automations.cron.dayPlural.5': 'viernes',
12
+ 'automations.cron.dayPlural.6': 'sábados',
13
+ 'automations.cron.daysAt': 'Los {{days}} a las {{time}}',
14
+ 'automations.cron.everyHour': 'Cada hora',
15
+ 'automations.cron.everyHours': 'Cada {{count}} horas',
16
+ 'automations.cron.everyMinutes': { one: 'Cada minuto', other: 'Cada {{count}} minutos' },
17
+ 'automations.cron.weekdaysAt': 'De lunes a viernes a las {{time}}',
18
+ 'automations.cron.weekendsAt': 'Los fines de semana a las {{time}}',
19
+ 'automations.trigger.anyApp': 'Cualquier app',
20
+ 'automations.trigger.anyEvent': 'Cualquier evento',
21
+ 'automations.trigger.manual': 'A petición',
22
+ 'automations.trigger.unscheduled': 'Sin programar',
23
+ 'chat.agentRun.by': 'por %{name}',
24
+ 'chat.agentRun.complete': 'Tarea completada',
25
+ 'chat.agentRun.completed': 'Completada',
26
+ 'chat.agentRun.credits': '%{count} créditos',
27
+ 'chat.agentRun.error': 'Error',
28
+ 'chat.agentRun.failed': 'Fallida',
29
+ 'chat.agentRun.planItems': '%{done}/%{total} pasos del plan',
30
+ 'chat.agentRun.planSummary': 'Resumen del plan',
31
+ 'chat.agentRun.steps': '%{count} pasos',
32
+ 'chat.agentRun.taskComplete': 'Tarea completada',
33
+ 'chat.agentRun.taskFailed': 'La tarea falló',
34
+ 'chat.agentRun.unknown': 'Desconocido',
35
+ 'chat.agentRun.working': 'Agente trabajando',
36
+ 'chat.backToLatest': 'Volver a lo último',
37
+ 'chat.blockFailed': 'Esta parte de la respuesta no se ha podido mostrar.',
38
+ 'chat.bloom.context.freeSpace': 'Espacio libre',
39
+ 'chat.bloom.context.mcp': 'Herramientas MCP',
40
+ 'chat.bloom.context.memory': 'Memoria',
41
+ 'chat.bloom.context.messages': 'Mensajes',
42
+ 'chat.bloom.context.skills': 'Skills',
43
+ 'chat.bloom.context.system': 'Prompt del sistema',
44
+ 'chat.bloom.context.title': 'Ventana de contexto',
45
+ 'chat.bloom.context.tools': 'Herramientas',
46
+ 'chat.bloom.createdFile': 'Creó',
47
+ 'chat.bloom.limits.close': 'Cerrar panel de créditos',
48
+ 'chat.bloom.limits.dailyFree': 'Créditos gratis diarios',
49
+ 'chat.bloom.limits.planUsage': 'Límites de uso del plan',
50
+ 'chat.bloom.limits.resetsDaily': 'Se renueva cada 24 horas',
51
+ 'chat.bloom.limits.resetsInHours': 'Se renueva en {{hours}} h {{minutes}} min',
52
+ 'chat.bloom.limits.resetsInMinutes': 'Se renueva en {{minutes}} min',
53
+ 'chat.bloom.limits.resetsSoon': 'Se renueva pronto',
54
+ 'chat.bloom.limits.window': 'Límite de {{hours}} horas',
55
+ 'chat.bloom.limits.windowFresh': 'Se renueva {{hours}} horas después de tu próximo mensaje',
56
+ 'chat.bloom.noResults': 'Sin resultados',
57
+ 'chat.bloom.researched': 'Investigó',
58
+ 'chat.bloom.researching': 'Investigando',
59
+ 'chat.bloom.resultCount': { one: '1 resultado', other: '{{count}} resultados' },
60
+ 'chat.bloom.scrollToLatest': 'Ir a los últimos mensajes',
61
+ 'chat.bloom.searchCount': { one: '1 búsqueda', other: '{{count}} búsquedas' },
62
+ 'chat.bloom.searchFailed': 'La búsqueda falló',
63
+ 'chat.bloom.searchedWeb': 'Buscó en la web',
64
+ 'chat.bloom.sourceCount': { one: '1 fuente', other: '{{count}} fuentes' },
65
+ 'chat.bloom.taskFailed': 'Devolvió un error',
66
+ 'chat.bloom.taskInput': 'Con',
67
+ 'chat.bloom.taskStopped': 'No terminó',
68
+ 'chat.bloom.visited': 'Visitó',
69
+ 'chat.bloom.writingFile': 'Escribiendo',
70
+ 'chat.copied': '¡Copiado!',
71
+ 'chat.copiedToClipboard': 'Copiado al portapapeles',
72
+ 'chat.copy': 'Copiar',
73
+ 'chat.copyFailed': 'No se pudo copiar al portapapeles',
74
+ 'chat.dislike': 'No me gusta',
75
+ 'chat.edit': 'Editar',
76
+ 'chat.feedbackFailed': 'No se ha podido guardar tu opinión.',
77
+ 'chat.like': 'Me gusta',
78
+ 'chat.loadingHistory': 'Cargando mensajes anteriores…',
79
+ 'chat.newConversationAccept': 'Empezar una nueva',
80
+ 'chat.newConversationDismiss': 'Ahora no',
81
+ 'chat.newConversationOffer': '¿Empezar una conversación nueva?',
82
+ 'chat.newStretch': 'Conversación nueva',
83
+ 'chat.readAloud': 'Leer en voz alta',
84
+ 'chat.readAloudFailed': 'No se pudo leer en voz alta',
85
+ 'chat.regenerate': 'Volver a generar',
86
+ 'chat.retry': 'Reintentar',
87
+ 'chat.richBlocks.source': 'Fuente: {{source}}',
88
+ 'chat.searchThreadAgent': 'Agente',
89
+ 'chat.searchThreadEmpty': 'No hay coincidencias.',
90
+ 'chat.searchThreadFailed': 'No se pudo buscar.',
91
+ 'chat.searchThreadHint':
92
+ 'Busca todo lo que le has dicho a este agente, en todas las conversaciones.',
93
+ 'chat.searchThreadPlaceholder': 'Buscar en este hilo',
94
+ 'chat.searchThreadSearching': 'Buscando…',
95
+ 'chat.searchThreadYou': 'Tú',
96
+ 'chat.sources': 'Fuentes',
97
+ 'chat.stopReading': 'Dejar de leer',
98
+ 'chat.thanksFeedback': '¡Gracias por tu opinión!',
99
+ 'chat.thinking': 'Pensando',
100
+ 'chat.today': 'Hoy',
101
+ 'chat.toolCard.openTask': 'Abrir la tarea programada %{objective}',
102
+ 'chat.toolCard.paused': 'En pausa',
103
+ 'chat.toolCard.scheduled': 'Programada',
104
+ 'chat.turnActions': 'Acciones del mensaje',
105
+ 'chat.consultFailed': '%{name} no pudo responder.',
106
+ 'chat.shareFailed': 'No se pudo crear el enlace para compartir.',
107
+ 'chat.sharedFailed': 'No se pudo cargar esta conversación.',
108
+ 'chat.sharedGone': 'Esta conversación compartida ya no está disponible.',
109
+ 'chat.turnFailed': 'Alia no ha podido responder ahora mismo.',
110
+ 'chat.turnFailedRetryHint': 'Inténtalo de nuevo.',
111
+ 'chat.turnInterrupted': 'Alia se interrumpió antes de terminar.',
112
+ 'chat.working': 'Trabajando',
113
+ 'chat.yesterday': 'Ayer',
114
+ 'common.close': 'Cerrar',
115
+ 'composer.cancelEdit': 'Cancelar',
116
+ 'composer.editPlaceholder': 'Edita tu mensaje',
117
+ 'composer.editingMessage': 'Editando mensaje',
118
+ 'faircoin.indexed':
119
+ 'Precio indexado del pool WFAIR/USDC en Base — FairCoin no cotiza en ningún exchange',
120
+ 'faircoin.liquidity': 'Liquidez',
121
+ 'faircoin.marketCap': 'Capitalización',
122
+ 'faircoin.name': 'FairCoin',
123
+ 'faircoin.noChart': 'Sólo hay una muestra — no bastan para trazar una línea.',
124
+ 'faircoin.noPrice': 'Sin cotización',
125
+ 'faircoin.noPriceHint': 'El pool WFAIR/USDC no tenía precio indexado cuando se preguntó.',
126
+ 'faircoin.noSamples': 'Todavía no hay muestras de este periodo.',
127
+ 'faircoin.range.1y': '1 A',
128
+ 'faircoin.range.24h': '24 h',
129
+ 'faircoin.range.30d': '30 D',
130
+ 'faircoin.range.7d': '7 D',
131
+ 'faircoin.range.all': 'Todo',
132
+ 'faircoin.scale.billion': ' mil M',
133
+ 'faircoin.scale.million': ' M',
134
+ 'faircoin.scale.thousand': ' mil',
135
+ 'faircoin.scale.trillion': ' B',
136
+ 'faircoin.source': 'De %{source}',
137
+ 'faircoin.symbol': 'FAIR',
138
+ 'faircoin.unavailable': 'Sin histórico para %{ranges}',
139
+ 'faircoin.updated': 'Actualizado %{time}',
140
+ 'faircoin.volume': 'Volumen 24 h',
141
+ 'market.dayHigh': 'Máximo del día',
142
+ 'market.dayLow': 'Mínimo del día',
143
+ 'market.marketCap': 'Capitalización',
144
+ 'market.noChart': 'No hay histórico suficiente para dibujar este rango',
145
+ 'market.noPrice': 'Sin cotización disponible',
146
+ 'market.open': 'Apertura',
147
+ 'market.range.1D': '1D',
148
+ 'market.range.1M': '1M',
149
+ 'market.range.1Y': '1A',
150
+ 'market.range.5D': '5D',
151
+ 'market.range.5Y': '5A',
152
+ 'market.range.6M': '6M',
153
+ 'market.range.MAX': 'MAX',
154
+ 'market.range.YTD': 'YTD',
155
+ 'market.volume': 'Volumen (24 h)',
156
+ 'panels.canvas.image': 'Imagen',
157
+ 'panels.canvas.unsupported': 'Tipo de componente no compatible: {{type}}',
158
+ 'panels.chart.share': 'Porcentaje',
159
+ 'panels.chart.value': 'Valor',
160
+ 'panels.code.copied': 'Código copiado',
161
+ 'panels.code.copy': 'Copiar código',
162
+ 'panels.form.enter': 'Escribe {{field}}',
163
+ 'panels.form.select': 'Selecciona…',
164
+ 'panels.form.submit': 'Enviar',
165
+ 'powerLevels.auto.description': 'Elige el nivel adecuado para cada mensaje',
166
+ 'powerLevels.auto.label': 'Auto',
167
+ 'powerLevels.high.description': 'Piensa más en las preguntas difíciles',
168
+ 'powerLevels.high.label': 'Alto',
169
+ 'powerLevels.instant.description': 'Lo más rápido y barato, para respuestas rápidas',
170
+ 'powerLevels.instant.label': 'Instantáneo',
171
+ 'powerLevels.medium.description': 'Rápido y capaz, para el día a día',
172
+ 'powerLevels.medium.label': 'Medio',
173
+ 'powerLevels.onDevice': 'En %{device}',
174
+ 'powerLevels.pro.description': 'Modelos punteros; más lento y más caro',
175
+ 'powerLevels.pro.label': 'Pro',
176
+ 'powerLevels.ultra.description': 'El más capaz; el más lento y el más caro',
177
+ 'powerLevels.ultra.label': 'Ultra',
178
+ 'powerLevels.xhigh.description': 'Piensa aún más; algo más lento',
179
+ 'powerLevels.xhigh.label': 'Muy alto',
180
+ 'tasks.tool.done.agentSearch': 'Buscó agentes',
181
+ 'tasks.tool.done.browse': 'Navegó',
182
+ 'tasks.tool.done.codeInterpreter': 'Ejecutó código',
183
+ 'tasks.tool.done.consultAgent': 'Consultó a un agente',
184
+ 'tasks.tool.done.fileEdit': 'Editó un archivo',
185
+ 'tasks.tool.done.generateFile': 'Generó un archivo',
186
+ 'tasks.tool.done.shellExec': 'Ejecutó un comando',
187
+ 'tasks.tool.done.loadTools': 'Cargó herramientas',
188
+ 'tasks.tool.done.userMemory': 'Recordó',
189
+ 'tasks.tool.done.webScraper': 'Leyó la página',
190
+ 'tasks.tool.pill.agentSearch': 'Buscando agentes',
191
+ 'tasks.tool.pill.browse': 'Navegando',
192
+ 'tasks.tool.pill.codeInterpreter': 'Ejecutando código',
193
+ 'tasks.tool.pill.consultAgent': 'Consultando a un agente',
194
+ 'tasks.tool.pill.fileEdit': 'Editando archivo',
195
+ 'tasks.tool.pill.generateFile': 'Generando archivo',
196
+ 'tasks.tool.pill.sendDiscord': 'Discord',
197
+ 'tasks.tool.pill.sendEmail': 'Correo',
198
+ 'tasks.tool.pill.sendSignal': 'Signal',
199
+ 'tasks.tool.pill.sendSlack': 'Slack',
200
+ 'tasks.tool.pill.sendTelegramMessage': 'Telegram',
201
+ 'tasks.tool.pill.shellExec': 'Ejecutando comando',
202
+ 'tasks.tool.pill.loadTools': 'Cargando herramientas',
203
+ 'tasks.tool.pill.userMemory': 'Recordando',
204
+ 'tasks.tool.pill.webScraper': 'Leyendo la página',
205
+ 'tasks.tool.pill.webSearch': 'Búsqueda web',
206
+ 'thought.activity': 'Actividad',
207
+ 'thought.audit.agent': 'Agente: {{name}}',
208
+ 'thought.audit.fileGenerated': 'Archivo generado',
209
+ 'thought.audit.plan': 'Plan',
210
+ 'thought.audit.planSteps': { one: '1 paso', other: '{{count}} pasos' },
211
+ 'thought.audit.researchComplete': 'Investigación completada',
212
+ 'thought.audit.researchIncomplete': 'Investigación incompleta',
213
+ 'thought.audit.researchPhase.decomposing': 'Investigación: desglosando la pregunta',
214
+ 'thought.audit.researchPhase.finalizing': 'Investigación: terminando',
215
+ 'thought.audit.researchPhase.follow_up': 'Investigación: profundizando',
216
+ 'thought.audit.researchPhase.reading': 'Investigación: leyendo artículos',
217
+ 'thought.audit.researchPhase.searching': 'Investigación: buscando fuentes',
218
+ 'thought.audit.researchPhase.synthesizing': 'Investigación: sintetizando hallazgos',
219
+ 'thought.audit.researching': 'Investigando',
220
+ 'thought.cancelled': 'Detenido',
221
+ 'thought.done': 'Listo',
222
+ 'thought.failed': 'Falló',
223
+ 'thought.failedAfter': 'Falló tras {{elapsed}}',
224
+ 'thought.filesAndSources': 'Archivos y fuentes',
225
+ 'thought.input': 'Entrada',
226
+ 'thought.loadFailed': 'No se pudo cargar esta conversación',
227
+ 'thought.loading': 'Cargando esta conversación…',
228
+ 'thought.messageGone': 'Este mensaje ya no está en la conversación',
229
+ 'thought.noActivity': 'Aún no hay acciones registradas',
230
+ 'thought.noOutputs': 'No se generaron archivos',
231
+ 'thought.noSources': 'No se usaron fuentes',
232
+ 'thought.noSteps': 'No hay pasos para mostrar',
233
+ 'thought.openOutput': 'Abrir {{name}} en el lienzo',
234
+ 'thought.output': 'Salida',
235
+ 'thought.outputs': 'Resultados',
236
+ 'thought.reasoning': 'Razonamiento',
237
+ 'thought.references': 'Referencias',
238
+ 'thought.sourceLabel': 'Fuente {{n}}: {{title}}',
239
+ 'thought.sources': 'Fuentes',
240
+ 'thought.steps': 'Pasos',
241
+ 'thought.stoppedAfter': 'Detenido tras {{elapsed}}',
242
+ 'thought.thinking': 'Pensando',
243
+ 'thought.thinkingFor': 'Pensando por {{seconds}}s...',
244
+ 'thought.thoughtFor': 'Pensó por {{seconds}} segundos',
245
+ 'thought.title': 'Pensamiento',
246
+ 'thought.tool.browse': 'Navegando por la web',
247
+ 'thought.tool.generateFile': 'Generando archivo',
248
+ 'thought.tool.getCurrentDate': 'Consultando la fecha actual',
249
+ 'thought.tool.getTimeline': 'Obteniendo la cronología',
250
+ 'thought.tool.getWhatsAppChats': 'Cargando chats de WhatsApp',
251
+ 'thought.tool.getWhatsAppMessages': 'Leyendo mensajes de WhatsApp',
252
+ 'thought.tool.saveUserMemory': 'Guardando en la memoria',
253
+ 'thought.tool.scrapeURL': 'Leyendo URL',
254
+ 'thought.tool.searchKnowledgeBase': 'Buscando en la base de conocimiento',
255
+ 'thought.tool.sendTelegramMessage': 'Enviando mensaje de Telegram',
256
+ 'thought.tool.sendWhatsAppMessage': 'Enviando mensaje de WhatsApp',
257
+ 'thought.tool.updateUserContext': 'Actualizando contexto',
258
+ 'thought.tool.updateUserPreferences': 'Actualizando preferencias',
259
+ 'thought.tool.webScraper': 'Leyendo página web',
260
+ 'thought.tool.webSearch': 'Buscando en la web',
261
+ 'thought.viewDetails': 'Ver detalles',
262
+ 'thought.websites': 'Sitios web',
263
+ 'thought.worked': 'Trabajó',
264
+ 'thought.workedFor': 'Trabajó durante {{elapsed}}',
265
+ 'thought.working': 'Trabajando…',
266
+ 'thought.workingFor': 'Trabajando desde hace {{elapsed}}…',
267
+ 'thought.writing': 'Escribiendo',
268
+ 'usageLimit.inputDisabledPlaceholder': 'Límite de uso alcanzado',
269
+ 'weather.condition.clear': 'Despejado',
270
+ 'weather.condition.cloudy': 'Nublado',
271
+ 'weather.condition.drizzle': 'Llovizna',
272
+ 'weather.condition.fog': 'Niebla',
273
+ 'weather.condition.partly-cloudy': 'Parcialmente nublado',
274
+ 'weather.condition.rain': 'Lluvia',
275
+ 'weather.condition.showers': 'Chubascos',
276
+ 'weather.condition.snow': 'Nieve',
277
+ 'weather.condition.snow-showers': 'Chubascos de nieve',
278
+ 'weather.condition.thunderstorm': 'Tormenta',
279
+ 'weather.toggleUnit': 'Cambiar unidad de temperatura',
280
+ };
package/src/lib/copy.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { COPY_EN, type CopyEntry } from './copy-en';
2
+ import { COPY_ES } from './copy-es';
2
3
 
3
4
  /**
4
5
  * A translator keyed the way the Alia app's own catalogue keys its strings, so the app hands its
@@ -21,12 +22,17 @@ const PLACEHOLDER = /\{\{\s*(\w+)\s*\}\}|%\{(\w+)\}/g;
21
22
  * The default translator: the English in `copy-en.ts`, with `{{count}}` plurals and parameters.
22
23
  * A key it does not know answers itself, so a missing string is visible rather than blank.
23
24
  */
24
- export const englishCopy: Translate = (key, params) => {
25
- const entry = COPY_EN[key];
26
- if (entry === undefined) return key;
27
- const count = typeof params?.count === 'number' ? params.count : undefined;
28
- return entryFor(entry, count).replace(PLACEHOLDER, (placeholder, a?: string, b?: string) => {
29
- const value = params?.[(a ?? b) as string];
30
- return value === undefined ? placeholder : String(value);
31
- });
32
- };
25
+ function createCopy(catalogue: Readonly<Record<string, CopyEntry>>): Translate {
26
+ return (key, params) => {
27
+ const entry = catalogue[key];
28
+ if (entry === undefined) return key;
29
+ const count = typeof params?.count === 'number' ? params.count : undefined;
30
+ return entryFor(entry, count).replace(PLACEHOLDER, (placeholder, a?: string, b?: string) => {
31
+ const value = params?.[(a ?? b) as string];
32
+ return value === undefined ? placeholder : String(value);
33
+ });
34
+ };
35
+ }
36
+
37
+ export const englishCopy = createCopy(COPY_EN);
38
+ export const spanishCopy = createCopy(COPY_ES);
@@ -0,0 +1,113 @@
1
+ import type { AliaChatLabels, VoiceBlockReason } from './labels';
2
+ import { spanishCopy } from './copy';
3
+ import type { VoiceCloseReason } from './voice-protocol';
4
+ import type { VoiceErrorCode } from './speech-messages';
5
+
6
+ const VOICE_ERRORS: Record<VoiceErrorCode, string> = {
7
+ 'not-authenticated': 'Inicia sesión para usar la voz',
8
+ 'credential-not-supported': 'La voz solo está disponible con tu sesión de Alia',
9
+ 'plan-required': 'El modo voz necesita un plan de pago',
10
+ 'credits-exhausted': 'Te has quedado sin créditos para esta llamada',
11
+ 'agent-unavailable': 'Este agente no está disponible para una llamada',
12
+ 'invalid-request': 'No se pudo iniciar la llamada',
13
+ 'resume-unavailable': 'No se pudo retomar la llamada: empieza una nueva',
14
+ 'realtime-unavailable': 'La voz no está disponible ahora mismo: inténtalo más tarde',
15
+ 'realtime-limited': 'La voz ha llegado a su límite por ahora: inténtalo más tarde',
16
+ 'realtime-rejected': 'No se pudo iniciar la llamada con esta configuración',
17
+ 'realtime-failed': 'La llamada ha fallado: inténtalo de nuevo',
18
+ 'mic-denied': 'Se necesita permiso para usar el micrófono',
19
+ 'mic-unavailable': 'No se pudo usar el micrófono: revisa tus dispositivos de entrada',
20
+ 'connection-lost': 'Se perdió la conexión',
21
+ 'voice-unavailable': 'La voz no está disponible en este dispositivo o navegador',
22
+ 'too-long': 'El dictado era demasiado largo: cinco minutos como máximo',
23
+ 'transcription-unavailable': 'El dictado no está disponible ahora mismo',
24
+ 'transcription-limited': 'El dictado ha llegado a su límite por ahora: inténtalo más tarde',
25
+ 'transcription-rejected': 'No se pudo transcribir esa grabación',
26
+ 'transcription-failed': 'Falló el dictado: inténtalo de nuevo',
27
+ };
28
+ const VOICE_ENDED: Partial<Record<VoiceCloseReason, string>> = {
29
+ 'call-moved-elsewhere': 'La llamada sigue en tu otro dispositivo',
30
+ 'max-duration': 'La llamada llegó a su límite de 30 minutos',
31
+ 'idle-timeout': 'La llamada terminó tras dos minutos de silencio',
32
+ 'credits-exhausted': 'La llamada terminó: te quedaste sin créditos',
33
+ 'server-shutdown': 'La llamada terminó mientras Alia se actualizaba: empieza una nueva',
34
+ };
35
+ const VOICE_BLOCKED: Record<VoiceBlockReason, string> = {
36
+ 'sign-in': 'Inicia sesión para usar la voz',
37
+ 'plan-required': 'El modo voz necesita un plan de pago',
38
+ 'credits-exhausted': 'Te has quedado sin créditos',
39
+ };
40
+
41
+ /** Built-in Spanish, shared by every app that embeds the chat. */
42
+ export const SPANISH_LABELS: AliaChatLabels = {
43
+ clear: 'Borrar',
44
+ back: 'Volver',
45
+ share: 'Compartir',
46
+ more: 'Más',
47
+ chatActions: 'Acciones de la conversación',
48
+ addMenuGroup: 'Adjuntar',
49
+ addPhotos: 'Fotos',
50
+ addDocuments: 'Archivos',
51
+ startVoice: 'Iniciar llamada',
52
+ voiceEndingSoon: 'Queda un minuto de llamada',
53
+ composerMessage: 'Mensaje',
54
+ composerAddMenu: 'Añadir al chat',
55
+ composerModes: 'Potencia',
56
+ composerVoice: 'Dictar',
57
+ composerSend: 'Enviar mensaje',
58
+ composerStop: 'Detener la generación',
59
+ composerRemove: 'Quitar',
60
+ composerRetry: 'Reintentar',
61
+ composerUntitled: 'sin título',
62
+ dropHint: 'Suelta los archivos aquí para adjuntarlos',
63
+ dropUnavailable: 'Ahora mismo no se pueden adjuntar archivos',
64
+ greeting: 'Hola, ¿qué tienes en mente?',
65
+ copy: 'Copiar',
66
+ helpful: 'Respuesta útil',
67
+ unhelpful: 'Respuesta poco útil',
68
+ copied: 'Copiado',
69
+ edit: 'Editar',
70
+ save: 'Guardar',
71
+ cancel: 'Cancelar',
72
+ readAloud: 'Leer en voz alta',
73
+ stopReading: 'Dejar de leer',
74
+ planTitle: 'Este es mi plan',
75
+ reasoning: 'Razonamiento',
76
+ locale: 'es',
77
+ newChat: 'Nueva conversación',
78
+ recentConversations: 'Recientes',
79
+ sendFailed:
80
+ 'No se pudo enviar el mensaje. Lo tienes de vuelta en el cuadro de texto, inténtalo otra vez.',
81
+ signInRequired: 'Inicia sesión para seguir conversando',
82
+ conversationSaveFailed: 'No se pudo guardar la conversación',
83
+ conversationDeleteFailed: 'No se pudo eliminar la conversación',
84
+ conversationCreateFailed: 'No se pudo crear la conversación',
85
+ conversationClearFailed: 'No se pudo borrar la conversación',
86
+ placeholder: (name) => `Pregúntale lo que quieras a ${name}`,
87
+ greetingNamed: (name) => `Hola ${name}, ¿qué tienes en mente?`,
88
+ fileReadFailed: (name) => `No se pudo leer ${name}: selecciona para reintentar`,
89
+ fileTooLarge: (name, limit) => `${name} supera ${limit} y no se ha adjuntado`,
90
+ fileEmpty: (name) => `${name} está vacío: no se pueden adjuntar carpetas`,
91
+ fileUnsupported: (name) => `No se puede enviar ${name} aquí: solo se admiten fotos`,
92
+ dictationRemaining: (seconds) => `Quedan ${seconds} s de dictado`,
93
+ thoughtFor: (seconds) => `Pensó durante ${seconds} segundos`,
94
+ attachmentNotSent: (name) => `No se envió ${name}: solo se pueden enviar fotos`,
95
+ attachmentUnreadable: (name) => `No se pudo leer ${name} y no se envió`,
96
+ voiceError: (code) => VOICE_ERRORS[code],
97
+ voiceEnded: (reason) => VOICE_ENDED[reason] ?? null,
98
+ voiceBlocked: (reason) => VOICE_BLOCKED[reason],
99
+ voiceControls: {
100
+ connecting: 'Conectando…',
101
+ reconnecting: 'Reconectando…',
102
+ connected: 'Conectado',
103
+ listening: 'Escuchando…',
104
+ muted: 'Silenciado',
105
+ thinking: 'Pensando…',
106
+ usingTool: 'Trabajando en ello…',
107
+ speaking: 'Hablando…',
108
+ mute: 'Silenciar',
109
+ unmute: 'Activar micrófono',
110
+ end: 'Colgar',
111
+ },
112
+ t: spanishCopy,
113
+ };
@@ -1,4 +1,5 @@
1
1
  import { createContext, type ReactNode, useContext, useMemo } from 'react';
2
+ import { SPANISH_LABELS } from './labels-es';
2
3
  import { VOICE_ERROR_MESSAGES, type VoiceErrorCode } from './speech-messages';
3
4
  import { englishCopy, type Translate } from './copy';
4
5
  import { VOICE_CONTROLS_LABELS, type VoiceControlsLabels } from './voice-controls-labels';
@@ -178,7 +179,7 @@ export const DEFAULT_LABELS: AliaChatLabels = {
178
179
  attachmentUnreadable: (name) => `${name} couldn't be read and wasn't sent`,
179
180
  };
180
181
 
181
- const LabelsContext = createContext<AliaChatLabels>(DEFAULT_LABELS);
182
+ const LabelsContext = createContext<AliaChatLabels | null>(null);
182
183
 
183
184
  /** The chat's labels: the defaults, with whatever the host overrides. */
184
185
  export function AliaChatLabelsProvider({
@@ -191,10 +192,16 @@ export function AliaChatLabelsProvider({
191
192
  // Over whatever labels are already in reach, so a part that takes its own `labels` (the
192
193
  // composer) refines the chat's copy instead of resetting it to English.
193
194
  const inherited = useContext(LabelsContext);
194
- const value = useMemo(() => ({ ...inherited, ...labels }), [inherited, labels]);
195
+ const value = useMemo(() => {
196
+ const locale = labels?.locale ?? inherited?.locale ?? 'en';
197
+ const language = locale.toLowerCase().split('-')[0];
198
+ const defaults = language === 'es' ? SPANISH_LABELS : DEFAULT_LABELS;
199
+ const parent = inherited?.locale.toLowerCase().split('-')[0] === language ? inherited : null;
200
+ return { ...defaults, ...parent, ...labels };
201
+ }, [inherited, labels]);
195
202
  return <LabelsContext.Provider value={value}>{children}</LabelsContext.Provider>;
196
203
  }
197
204
 
198
205
  export function useLabels(): AliaChatLabels {
199
- return useContext(LabelsContext);
206
+ return useContext(LabelsContext) ?? DEFAULT_LABELS;
200
207
  }