feat(studio): Doctor + Modules localized + sparse-store federation nudge (v0.25.0)

Two threads.

Translation expansion: every visible string on the Doctor
page (section headers, status text, button labels, daemon-
control card, daemon-files panel, update banner) and the
Modules page (recent-activity strip, capabilities label,
uninstall dialog + toast) flips between DE and EN with the
sidebar toggle. Adds ~50 ARB keys split between
`app_en.arb` / `app_de.arb`. Pluralised + parametrised
strings (`{n} events verified`, `Running on {name}: {endpoint}`)
use the standard ICU placeholder syntax so future locales
slot in without code changes.

Sparse-store federation nudge: the Store page renders an
inline banner above the grid when the operator has zero
federated entries — single biggest store-fullness lever is
configuring an MCP server / n8n endpoint, so the banner
says exactly that and the button opens Settings straight
to the editor. Banner dismisses automatically the next
render after a federated entry appears.

Coverage stand for translation: Doctor + Modules + sidebar
+ page titles + nav + Cmd+K labels are bilingual. Settings
dialog, Approvals cards, Audit drilldown, MCP/n8n editors,
Store search hint + filter chips remain English-literal.
The infrastructure (ARB plumbing, generator hookup,
locale-notifier) means each follow-up surface is a
one-line ARB edit + one call-site swap.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-08 01:39:42 +02:00
parent ee83eb851a
commit 349619d68e
11 changed files with 1091 additions and 80 deletions

View file

@ -36,7 +36,7 @@ class _DoctorPageState extends State<DoctorPage> {
actions: [
IconButton(
icon: const Icon(Icons.refresh, size: 18),
tooltip: 'Re-check',
tooltip: AppLocalizations.of(context)!.doctorRecheckTooltip,
onPressed: _refresh,
),
const SizedBox(width: FaiSpace.sm),
@ -49,14 +49,15 @@ class _DoctorPageState extends State<DoctorPage> {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
final l = AppLocalizations.of(context)!;
return FaiEmptyState(
icon: Icons.cloud_off_outlined,
iconColor: Theme.of(context).colorScheme.error,
title: 'Hub unreachable',
hint: 'Start the hub with `fai serve`.',
title: l.hubUnreachable,
hint: l.hubUnreachableHint,
action: FilledButton.tonal(
onPressed: _refresh,
child: const Text('Retry'),
child: Text(l.buttonRetry),
),
);
}
@ -72,7 +73,7 @@ class _DoctorPageState extends State<DoctorPage> {
_SummaryStrip(snapshot: s),
const SizedBox(height: FaiSpace.xl),
_Section(
title: 'Event log',
title: AppLocalizations.of(context)!.doctorEventLogSection,
child: _EventLogPanel(
snapshot: s,
onRefresh: _refresh,
@ -80,22 +81,22 @@ class _DoctorPageState extends State<DoctorPage> {
),
const SizedBox(height: FaiSpace.lg),
_Section(
title: 'Modules & approvals',
title: AppLocalizations.of(context)!.doctorModulesApprovalsSection,
child: _ModulesPanel(snapshot: s),
),
const SizedBox(height: FaiSpace.lg),
_Section(
title: 'Host services',
title: AppLocalizations.of(context)!.doctorHostServicesSection,
child: _ServicesPanel(snapshot: s),
),
const SizedBox(height: FaiSpace.lg),
_Section(
title: 'Daemon files',
title: AppLocalizations.of(context)!.doctorDaemonFilesSection,
child: _DaemonPathsPanel(paths: s.paths),
),
const SizedBox(height: FaiSpace.lg),
_Section(
title: 'Daemon control',
title: AppLocalizations.of(context)!.doctorDaemonControlSection,
child: _DaemonActionsCard(),
),
],
@ -266,6 +267,7 @@ class _EventLogPanel extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Theme.of(context);
final healthy = snapshot.chainHealthy;
final l = AppLocalizations.of(context)!;
return FaiCard(
child: Row(
children: [
@ -280,9 +282,7 @@ class _EventLogPanel extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
healthy
? 'Hash chain intact'
: 'Tampering detected',
healthy ? l.doctorChainIntact : l.doctorChainTampered,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),
@ -290,8 +290,12 @@ class _EventLogPanel extends StatelessWidget {
const SizedBox(height: 2),
Text(
healthy
? '${snapshot.eventChainTotal} events · prev_event_sha256 verified end-to-end'
: '${snapshot.eventChainVerified} of ${snapshot.eventChainTotal} verified before mismatch at ${snapshot.eventChainTamperedAt}',
? l.doctorChainIntactDetail(snapshot.eventChainTotal)
: l.doctorChainTamperedDetail(
snapshot.eventChainVerified,
snapshot.eventChainTotal,
snapshot.eventChainTamperedAt ?? '',
),
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
@ -302,11 +306,11 @@ class _EventLogPanel extends StatelessWidget {
OutlinedButton.icon(
onPressed: onRefresh,
icon: const Icon(Icons.fact_check_outlined, size: 16),
label: const Text('Verify now'),
label: Text(l.doctorVerifyNow),
),
const SizedBox(width: FaiSpace.sm),
FaiPill(
label: healthy ? 'WORM-1' : 'TAMPER',
label: healthy ? l.doctorChainPillOk : l.doctorChainPillTamper,
tone: healthy ? FaiPillTone.success : FaiPillTone.danger,
),
],
@ -326,20 +330,20 @@ class _DaemonPathsPanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l = AppLocalizations.of(context)!;
final entries = <(String, String, IconData)>[
('Log', paths.logPath, Icons.description_outlined),
('Config', paths.configPath, Icons.settings_outlined),
('Audit DB', paths.dbPath, Icons.storage_outlined),
('Modules dir', paths.modulesDir, Icons.extension_outlined),
('Flows dir', paths.flowsDir, Icons.account_tree_outlined),
('PID file', paths.pidPath, Icons.fingerprint),
(l.doctorPathLog, paths.logPath, Icons.description_outlined),
(l.doctorPathConfig, paths.configPath, Icons.settings_outlined),
(l.doctorPathDb, paths.dbPath, Icons.storage_outlined),
(l.doctorPathModules, paths.modulesDir, Icons.extension_outlined),
(l.doctorPathFlows, paths.flowsDir, Icons.account_tree_outlined),
(l.doctorPathPid, paths.pidPath, Icons.fingerprint),
].where((e) => e.$2.isNotEmpty).toList();
if (entries.isEmpty) {
return FaiCard(
child: Text(
'Daemon did not report file paths. '
'Update the running hub via `fai daemon restart`.',
l.doctorPathsEmpty,
style: Theme.of(context).textTheme.bodySmall,
),
);
@ -396,13 +400,14 @@ class _PathRow extends StatelessWidget {
final r = await SystemActions.openInOs(path);
if (!context.mounted) return;
if (!r.ok) {
final l = AppLocalizations.of(context)!;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Could not open: ${r.stderr}')),
SnackBar(content: Text(l.doctorOpenError(r.stderr))),
);
}
},
icon: const Icon(Icons.open_in_new, size: 14),
label: const Text('Open'),
label: Text(AppLocalizations.of(context)!.buttonOpen),
style: OutlinedButton.styleFrom(
visualDensity: VisualDensity.compact,
),
@ -468,6 +473,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final l = AppLocalizations.of(context)!;
ChannelInfo? active;
if (_channels != null) {
for (final c in _channels!.channels) {
@ -502,10 +508,10 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
Expanded(
child: Text(
active == null
? 'Daemon status: …'
? l.doctorStatusUnknown
: active.running
? 'Running on ${active.name}: ${active.endpoint}'
: '${active.name} daemon stopped',
? l.doctorRunningOn(active.name, active.endpoint)
: l.doctorStoppedOn(active.name),
style: theme.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w500,
),
@ -514,22 +520,20 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
),
if (active != null) ...[
const SizedBox(width: FaiSpace.sm),
Tooltip(
message: 'PID file at the channel\'s run/<name>.pid',
child: FaiPill(
label: active.running ? 'running' : 'stopped',
tone: active.running
? FaiPillTone.success
: FaiPillTone.neutral,
),
FaiPill(
label: active.running
? l.doctorPillRunning
: l.doctorPillStopped,
tone: active.running
? FaiPillTone.success
: FaiPillTone.neutral,
),
],
],
),
const SizedBox(height: FaiSpace.sm),
Text(
'Studio shells out to the platform binary — mirrors '
'`fai daemon …` exactly so the CLI and UI stay in lockstep.',
l.doctorDaemonControlHint,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
@ -547,7 +551,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
() => SystemActions.faiDaemon(['restart']),
),
icon: const Icon(Icons.restart_alt, size: 16),
label: const Text('Restart'),
label: Text(l.doctorRestart),
),
if (active?.running != true)
FilledButton.icon(
@ -558,7 +562,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
() => SystemActions.faiDaemon(['start']),
),
icon: const Icon(Icons.play_arrow, size: 16),
label: const Text('Start'),
label: Text(l.doctorStart),
),
OutlinedButton.icon(
onPressed: _busy
@ -568,7 +572,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
() => SystemActions.faiDaemon(['stop']),
),
icon: const Icon(Icons.stop_circle_outlined, size: 16),
label: const Text('Stop'),
label: Text(l.doctorStop),
),
OutlinedButton.icon(
onPressed: _busy
@ -578,7 +582,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
() => SystemActions.faiDaemon(['status']),
),
icon: const Icon(Icons.health_and_safety_outlined, size: 16),
label: const Text('Status'),
label: Text(l.doctorStatusAction),
),
],
),
@ -593,7 +597,7 @@ class _DaemonActionsCardState extends State<_DaemonActionsCard> {
),
const SizedBox(width: FaiSpace.sm),
Text(
'Working…',
l.doctorDaemonControlWorking,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
@ -797,7 +801,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
setState(() {
_applying = false;
_applyOutput = r.ok
? 'Update applied. Restart Studio to see the new daemon version.'
? AppLocalizations.of(context)!.doctorApplyDone
: (r.stderr.isEmpty ? r.stdout : r.stderr).trim();
});
}
@ -805,6 +809,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final l = AppLocalizations.of(context)!;
final status = widget.status;
final available = status.updateAvailable;
final iconData = available
@ -814,13 +819,11 @@ class _UpdateBannerState extends State<_UpdateBanner> {
? theme.colorScheme.primary
: theme.colorScheme.onSurfaceVariant;
final title = available
? 'Update available — ${status.latestVersion}'
: 'Release host unreachable';
? l.doctorUpdateAvailable(status.latestVersion)
: l.doctorUpdateUnreachable;
final body = available
? 'Channel ${status.channel} now offers ${status.latestVersion}. '
'Apply via the button — Studio shells out to '
'`fai update apply --channel ${status.channel}`.'
: (status.reason ?? 'Could not contact the release feed for ${status.channel}.');
? l.doctorUpdateBody(status.channel, status.latestVersion)
: (status.reason ?? l.doctorUpdateUnreachableBody(status.channel));
return FaiCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -851,7 +854,7 @@ class _UpdateBannerState extends State<_UpdateBanner> {
if (available && status.releaseNotesUrl != null) ...[
const SizedBox(height: 4),
Text(
'notes: ${status.releaseNotesUrl}',
l.doctorReleaseNotes(status.releaseNotesUrl!),
style: FaiTheme.mono(
size: 11,
color: theme.colorScheme.primary,
@ -871,11 +874,11 @@ class _UpdateBannerState extends State<_UpdateBanner> {
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Icon(Icons.system_update_alt, size: 16),
label: Text(_applying ? 'Applying…' : 'Apply update'),
label: Text(_applying ? l.doctorApplying : l.doctorApplyUpdate),
),
const SizedBox(width: FaiSpace.sm),
FaiPill(
label: available ? 'new' : 'offline',
label: available ? l.doctorPillNew : l.doctorPillOffline,
tone: available ? FaiPillTone.success : FaiPillTone.neutral,
),
],