Files
TREK/shared/src/i18n/de/common.ts
T
Maurice 39b6d9f786 feat(client): catch render errors instead of blanking the page (#1805)
* feat(client): catch render errors instead of blanking the page

There were no error boundaries anywhere, so one throw during render unmounted the
whole tree and left the user staring at a white page with no way back.

ErrorBoundary holds the state in a class — getDerivedStateFromError has no hook
equivalent — and renders a function component for the visible half, so the panel
can translate normally. TranslationContext isn't exported, so contextType was not
an option anyway.

Two things it does beyond showing a message. A chunk that 404s after a deploy gets
one reload rather than a retry button: React.lazy caches the rejected promise, so
retrying re-throws immediately. And the reload happens once per session, or a
genuinely missing chunk would spin the tab.

The global handlers in main.tsx cover what no boundary reaches — event handlers
and async code. They filter axios errors: the interceptor already redirects on
401/403 and there are 600+ toast.error call sites, so reporting again would mean
double toasts and, for the redirects, loops.

* feat(client): isolate routes, widgets and the shell chrome

The route boundary goes on the single line where all 16 protected routes render
their content, inside MobileShell rather than around it: the navigation survives,
so a broken page is something the user can walk away from instead of a dead end.
The mobile --m-* tokens live on the shell's .m-root too, so a fallback outside it
would render invisible.

key={location.pathname}, not resetKeys — ProtectedRoute is the same component at
the same position for every protected route, so otherwise a failure could follow
the user across a navigation.

The public routes render outside ProtectedRoute and were therefore uncovered,
including /login (where people land when everything else failed) and the two
anonymous share pages. PublicRoute wraps those seven.

The five global widgets and the shell chrome get fallback={null} each: a broken
widget should disappear quietly, and if BottomNav dies the user loses the very
thing they need to leave the route.

* feat(client): isolate the GL maps and the plugin frame

Both map wrappers put the boundary outside their Suspense, not inside: Suspense
handles a pending promise, a rejected one throws straight past it. Falling back to
the Leaflet renderer keeps a usable map rather than showing an error card — the
same downgrade the Suspense fallback already does while loading.

PluginFrame is third-party code rendering in our tree; a throw there should cost
the plugin, not the page. resetKeys={[pluginId]} so switching plugins clears it.

The locale loader had no .catch (TranslationContext.tsx). After a deploy the chunk
can be gone, which produced an unhandled rejection and left the UI silently on the
previous language. It now keeps the strings it has and says so in the console.
2026-08-06 23:42:57 +02:00

78 lines
3.0 KiB
TypeScript

import type { TranslationStrings } from '../types';
const common: TranslationStrings = {
'common.save': 'Speichern',
'common.showMore': 'Mehr anzeigen',
'common.showLess': 'Weniger anzeigen',
'common.cancel': 'Abbrechen',
'common.clear': 'Löschen',
'common.delete': 'Löschen',
'common.preview': 'Vorschau',
'common.edit': 'Bearbeiten',
'common.add': 'Hinzufügen',
'common.loading': 'Laden...',
'common.import': 'Importieren',
'common.select': 'Auswählen',
'common.selectAll': 'Alle auswählen',
'common.deselectAll': 'Alle abwählen',
'common.error': 'Fehler',
'common.success': 'Erfolg',
'common.unknownError': 'Unbekannter Fehler',
'common.tooManyAttempts': 'Zu viele Versuche. Bitte versuchen Sie es später erneut.',
'common.back': 'Zurück',
'common.all': 'Alle',
'common.close': 'Schließen',
'common.open': 'Öffnen',
'common.upload': 'Hochladen',
'common.search': 'Suchen',
'common.confirm': 'Bestätigen',
'common.ok': 'OK',
'common.yes': 'Ja',
'common.no': 'Nein',
'common.or': 'oder',
'common.none': 'Keine',
'common.date': 'Datum',
'common.rename': 'Umbenennen',
'common.discardChanges': 'Änderungen verwerfen',
'common.discard': 'Verwerfen',
'common.name': 'Name',
'common.email': 'E-Mail',
'common.password': 'Passwort',
'common.saving': 'Speichern...',
'common.expand': 'Erweitern',
'common.collapse': 'Einklappen',
'common.justNow': 'gerade eben',
'common.hoursAgo': 'vor {count}h',
'common.daysAgo': 'vor {count}T',
'common.saved': 'Gespeichert',
'common.update': 'Aktualisieren',
'common.change': 'Ändern',
'common.uploading': 'Hochladen…',
'common.backToPlanning': 'Zurück zur Planung',
'common.reset': 'Zurücksetzen',
'common.copy': 'Kopieren',
'common.copied': 'Kopiert',
'common.datepicker.prevMonth': 'Vormonat',
'common.datepicker.nextMonth': 'Nächster Monat',
'common.datepicker.prevYear': 'Vorjahr',
'common.datepicker.nextYear': 'Nächstes Jahr',
'common.datepicker.prevYears': 'Vorherige Jahre',
'common.datepicker.nextYears': 'Nächste Jahre',
'common.datepicker.selectMonth': 'Monat auswählen',
'common.datepicker.selectYear': 'Jahr auswählen',
'common.datepicker.enterManually': 'Datum manuell eingeben',
'common.datepicker.typeDate': 'Datum eingeben',
'common.datepicker.dialog': 'Datumsauswahl',
'common.datepicker.clearDate': 'Datum löschen',
'common.errorTitle': 'Etwas ist schiefgelaufen',
'common.errorBody': 'Dieser Teil der App funktioniert nicht mehr. Deine Daten sind sicher.',
'common.errorPanelTitle': 'Dieser Bereich konnte nicht angezeigt werden',
'common.errorPanelBody': 'Der Rest der Seite funktioniert weiterhin.',
'common.errorRetry': 'Erneut versuchen',
'common.errorReload': 'Seite neu laden',
'common.errorUpdateTitle': 'Eine neue Version ist verfügbar',
'common.errorUpdateBody': 'TREK wurde aktualisiert, während dieser Tab offen war. Lade neu, um die neue Version zu erhalten.',
'common.errorPluginTitle': 'Dieses Plugin konnte nicht angezeigt werden',
};
export default common;