Files
TREK/shared/src/i18n/br/externalNotifications.ts
T
Maurice 2e1dca9fe9 feat(tours): let a background check hint at changes of your own wanderer trails
Settings, Integrations, wanderer gains an optional background check of the
trails you imported, off until you switch it on. While on, TREK reads the
short record of each such trail at most once a day (never its GPX file) and
leaves a hint when the trail may have moved on: "may have changed" when only
wanderer's change time moved, "changed" when its name or description proves
it, and "not checkable" when the trail is gone, no longer yours or carries no
change time. Nothing is ever said to be unchanged. A new hint arrives as a
notification that opens the tour (a new ?place= link in the planner); the
tour's provenance shows it with the source check right beside it, and the
card lists all open hints in a dialog, each leading to its tour. The check
reads the source in full as before and spends the hint; taking a change in
stays the confirmed reimport. No tour is ever changed or deleted.

The check only asks through your own connection, only about trails your
account imported into trips you can still open, and stops when you switch it
off, remove the connection, wanderer refuses the token (until a test passes
or a new token is saved) or the admin switches wanderer off; hints and
snapshots stay. A run asks at most 25 connections for at most 10 records
each, one after another, and an instance that fails (an outage, a rate
limit) is left alone for an hour, doubling up to two days.

Server: migration 046120 adds the switch and the run bookkeeping to
wanderer_connections and the tour_source_hints table (one row per snapshot,
for its importer, gone with it). WandererWatchService and an hourly
wanderer-watch job on the CronRegistrar live in the tours domain and read
through WandererService; GET and PUT /api/integrations/wanderer/watch and GET
/api/trips/:tripId/tours/wanderer/sources/:placeId/hint (place_edit, like the
check) answer with @trek/shared contracts. A new user notification event,
wanderer_source_hint, can be muted per channel. Saving a new token now clears
what the last check said about the old one. There is no MCP tool, as for the
rest of the personal wanderer connection. All 27 locales carry the strings,
and the admin wiki page says what the check does.
2026-10-20 15:35:32 +02:00

103 lines
4.4 KiB
TypeScript

import type { NotificationLocale } from '../externalNotifications/types';
import { pluralForm } from '../plural';
const br: NotificationLocale = {
email: {
footer: 'Você recebeu isso porque tem as notificações ativadas no TREK.',
manage: 'Gerenciar preferências nas configurações',
madeWith: 'Made with',
openTrek: 'Abrir TREK',
},
events: {
trip_invite: (p) => ({
title: `Convite para "${p.trip}"`,
body: `${p.actor} convidou ${p.invitee || 'um membro'} para a viagem "${p.trip}".`,
}),
booking_change: (p) => ({
title: `Nova reserva: ${p.booking}`,
body: `${p.actor} adicionou uma reserva "${p.booking}" (${p.type}) em "${p.trip}".`,
}),
trip_reminder: (p) => ({
title: `Lembrete: ${p.trip}`,
body: `Sua viagem "${p.trip}" está chegando!`,
}),
todo_due: (p) => ({
title: `Tarefa com vencimento: ${p.todo}`,
body: `"${p.todo}" em "${p.trip}" vence em ${p.due}.`,
}),
vacay_invite: (p) => ({
title: 'Convite Vacay Fusion',
body: `${p.actor} convidou você para fundir planos de férias. Abra o TREK para aceitar ou recusar.`,
}),
vacay_share: (p) => ({
title: 'Calendário Vacay compartilhado',
body: `${p.actor} compartilhou o calendário de férias com você. Abra o TREK para visualizar.`,
}),
collection_invite: (p) => ({
title: 'Convite para coleção',
body: `${p.actor} convidou você para compartilhar uma coleção. Abra o TREK para aceitar ou recusar.`,
}),
photos_shared: (p) => ({
title: pluralForm(p.count, 'pt-BR', {
one: `${p.count} foto compartilhada`,
other: `${p.count} fotos compartilhadas`,
}),
body: pluralForm(p.count, 'pt-BR', {
one: `${p.actor} compartilhou ${p.count} foto em "${p.trip}".`,
other: `${p.actor} compartilhou ${p.count} fotos em "${p.trip}".`,
}),
}),
collab_message: (p) => ({
title: `Nova mensagem em "${p.trip}"`,
body: `${p.actor}: ${p.preview}`,
}),
packing_tagged: (p) => ({
title: `Bagagem: ${p.category}`,
body: `${p.actor} atribuiu você à categoria "${p.category}" em "${p.trip}".`,
}),
version_available: (p) => ({
title: 'Nova versão do TREK disponível',
body: `O TREK ${p.version} está disponível. Acesse o painel de administração para atualizar.`,
}),
replica_failure: (p) => ({
title: 'Falha na réplica de armazenamento',
body:
`Falha ao gravar na réplica '${p.backend}': ${p.op} de ${p.key} — ${p.error}.` +
(p.suppressed !== '0'
? pluralForm(p.suppressed, 'pt-BR', {
one: ` Mais ${p.suppressed} falha foi suprimida desde a última notificação.`,
other: ` Mais ${p.suppressed} falhas foram suprimidas desde a última notificação.`,
})
: ''),
}),
paddle_region_requested: (p) => ({
title: 'Região de remo pedida',
body: `${p.actor} está planejando um passeio de remo em ${p.region}. Carregue ou recuse os dados de água na administração, em Complementos.`,
}),
synology_session_cleared: () => ({
title: 'Sessão Synology encerrada',
body: 'Sua conta ou URL do Synology foi alterada. Você foi desconectado do Synology Photos.',
}),
wanderer_source_hint: (p) => ({
title: `Trilha do wanderer: ${p.tour}`,
body:
p.state === 'changed'
? `“${p.tour}” em “${p.trip}” foi alterada no wanderer. Abra o passeio e verifique a fonte para ver todas as mudanças. Nada na viagem muda sozinho.`
: p.state === 'unverifiable'
? `“${p.tour}” em “${p.trip}” não pode mais ser verificada no wanderer. O passeio da sua viagem continua como está.`
: `“${p.tour}” em “${p.trip}” pode ter mudado no wanderer. Abra o passeio e verifique a fonte para saber. Nada na viagem muda sozinho.`,
}),
plugin_notification: (p) => ({ title: p.title ?? '', body: p.body ?? '' }),
},
passwordReset: {
subject: 'Redefinir sua senha',
greeting: 'Olá',
body: 'Recebemos um pedido para redefinir a senha da sua conta TREK. Clique no botão abaixo para definir uma nova senha.',
ctaIntro: 'Redefinir senha',
expiry: 'Este link expira em 60 minutos.',
ignore: 'Se você não solicitou isto, pode ignorar este e-mail — sua senha não será alterada.',
},
};
export default br;