@quazardous/qdadm 2.33.0 → 2.34.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quazardous/qdadm",
3
- "version": "2.33.0",
3
+ "version": "2.34.0",
4
4
  "description": "Vue 3 framework for admin dashboards with PrimeVue",
5
5
  "author": "quazardous",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  "test": "vitest run",
20
20
  "test:watch": "vitest",
21
21
  "gen:i18n-defaults": "node scripts/gen-i18n-defaults.mjs",
22
+ "gen:debug-css": "node scripts/gen-debug-css.mjs",
22
23
  "type-check": "vue-tsc --noEmit && vue-tsc --noEmit -p tsconfig.typetest.json",
23
24
  "lint": "eslint src/",
24
25
  "lint:fix": "eslint src/ --fix",
@@ -61,7 +62,7 @@
61
62
  "dist/styles"
62
63
  ],
63
64
  "dependencies": {
64
- "@quazardous/qdcore": "^1.2.0",
65
+ "@quazardous/qdcore": "^1.3.0",
65
66
  "@quazardous/qddebug": "^1.3.0",
66
67
  "@quazardous/quarkernel": "^2.1.0",
67
68
  "yaml": "^2.8.4"
@@ -39,10 +39,10 @@
39
39
  * - loading: boolean - shows loading state on submit button
40
40
  * - width: string - dialog width (default: '800px')
41
41
  * - linear: boolean - require validation before next step (default: true)
42
- * - submitLabel: string - label for submit button (default: 'Submit')
43
- * - cancelLabel: string - label for cancel button (default: 'Cancel')
44
- * - nextLabel: string - label for next button (default: 'Next')
45
- * - backLabel: string - label for back button (default: 'Back')
42
+ * - submitLabel: string - label for submit button (default: core.actions.submit)
43
+ * - cancelLabel: string - label for cancel button (default: core.actions.cancel)
44
+ * - nextLabel: string - label for next button (default: core.actions.next)
45
+ * - backLabel: string - label for back button (default: core.actions.back)
46
46
  * - showBackOnFirst: boolean - show back button on first step (default: false)
47
47
  * - hideStepIndicator: boolean - hide the step indicator (default: false)
48
48
  *
@@ -59,6 +59,7 @@
59
59
  import { computed, watch, type PropType } from 'vue'
60
60
  import Dialog from 'primevue/dialog'
61
61
  import QdButton from '../base/QdButton.vue'
62
+ import { useI18n } from '../../i18n/useI18n'
62
63
  import Stepper from 'primevue/stepper'
63
64
  import StepList from 'primevue/steplist'
64
65
  import Step from 'primevue/step'
@@ -88,6 +89,8 @@ export interface SlotActions {
88
89
  cancel: () => void
89
90
  }
90
91
 
92
+ const { tOr } = useI18n()
93
+
91
94
  const props = defineProps({
92
95
  visible: {
93
96
  type: Boolean,
@@ -120,19 +123,19 @@ const props = defineProps({
120
123
  },
121
124
  submitLabel: {
122
125
  type: String,
123
- default: 'Submit'
126
+ default: ''
124
127
  },
125
128
  cancelLabel: {
126
129
  type: String,
127
- default: 'Cancel'
130
+ default: ''
128
131
  },
129
132
  nextLabel: {
130
133
  type: String,
131
- default: 'Next'
134
+ default: ''
132
135
  },
133
136
  backLabel: {
134
137
  type: String,
135
- default: 'Back'
138
+ default: ''
136
139
  },
137
140
  showBackOnFirst: {
138
141
  type: Boolean,
@@ -286,7 +289,7 @@ const slotActions = computed<SlotActions>(() => ({
286
289
  <!-- Back button -->
287
290
  <QdButton
288
291
  v-if="!isFirstStep || showBackOnFirst"
289
- :label="backLabel"
292
+ :label="backLabel || tOr('core.actions.back', 'Back')"
290
293
  icon="pi pi-arrow-left"
291
294
  severity="secondary"
292
295
  @click="goPrev"
@@ -295,7 +298,7 @@ const slotActions = computed<SlotActions>(() => ({
295
298
 
296
299
  <!-- Cancel button -->
297
300
  <QdButton
298
- :label="cancelLabel"
301
+ :label="cancelLabel || tOr('core.actions.cancel', 'Cancel')"
299
302
  severity="secondary"
300
303
  @click="cancel"
301
304
  :disabled="loading"
@@ -304,7 +307,7 @@ const slotActions = computed<SlotActions>(() => ({
304
307
  <!-- Next button (not on last step) -->
305
308
  <QdButton
306
309
  v-if="!isLastStep"
307
- :label="nextLabel"
310
+ :label="nextLabel || tOr('core.actions.next', 'Next')"
308
311
  icon="pi pi-arrow-right"
309
312
  iconPos="right"
310
313
  @click="goNext"
@@ -314,7 +317,7 @@ const slotActions = computed<SlotActions>(() => ({
314
317
  <!-- Submit button (only on last step) -->
315
318
  <QdButton
316
319
  v-if="isLastStep"
317
- :label="submitLabel"
320
+ :label="submitLabel || tOr('core.actions.submit', 'Submit')"
318
321
  icon="pi pi-check"
319
322
  @click="submit"
320
323
  :loading="loading"
@@ -258,20 +258,22 @@ const fullFormat = computed(() => new Intl.DateTimeFormat(locale.value, { dateSt
258
258
 
259
259
  const rows = computed<Row[]>(() => {
260
260
  const visible = chronological.value.filter((e) => !e.item.actor || !hiddenActors.value.has(e.item.actor))
261
- const withSince = visible.map((entry, i) => ({
262
- entry,
263
- since: props.gaps === true && i > 0 ? duration(entry.time - visible[i - 1]!.time) : null,
264
- }))
265
- const ordered = currentOrder.value === 'desc' ? [...withSince].reverse() : withSince
261
+ const ordered = currentOrder.value === 'desc' ? [...visible].reverse() : visible
266
262
  const out: Row[] = []
267
263
  let lastDay = ''
268
- for (const { entry, since } of ordered) {
264
+ let previous: (typeof visible)[number] | null = null
265
+ for (const entry of ordered) {
269
266
  const day = dayFormat.value.format(entry.time)
270
- if (day !== lastDay) {
267
+ const newDay = day !== lastDay
268
+ if (newDay) {
271
269
  out.push({ type: 'day', key: `day:${day}`, day })
272
270
  lastDay = day
273
271
  }
272
+ // The gap sits above an event and reads from the row above it, in either
273
+ // order. Under a day separator it is left out: the date says it.
274
+ const since = props.gaps === true && previous && !newDay ? duration(Math.abs(entry.time - previous.time)) : null
274
275
  out.push({ type: 'event', key: entry.key, entry, since })
276
+ previous = entry
275
277
  }
276
278
  return out
277
279
  })
@@ -58,6 +58,11 @@ const props = withDefaults(defineProps<Props>(), {
58
58
  maxLines: 100_000,
59
59
  })
60
60
 
61
+ const emit = defineEmits<{
62
+ /** The source reported the end of the log. */
63
+ done: []
64
+ }>()
65
+
61
66
  const { t } = useI18n()
62
67
 
63
68
  const log: UseLogStreamReturn =
@@ -272,6 +277,12 @@ function download(): void {
272
277
 
273
278
  // --- Status ---
274
279
 
280
+ watch(
281
+ () => log.status.value,
282
+ (status) => status === 'done' && emit('done'),
283
+ { immediate: true }
284
+ )
285
+
275
286
  const statusLabel = computed(() => {
276
287
  switch (log.status.value) {
277
288
  case 'streaming':
@@ -19,6 +19,7 @@ import { computed, watch, inject, type Ref } from 'vue'
19
19
  import { useRoute, useRouter } from 'vue-router'
20
20
  import { getSiblingRoutes, getChildRoutes, routeParamsSatisfied, type ModuleRoute, type ParentConfig } from '../../module/moduleRegistry'
21
21
  import { useOrchestrator } from '../../orchestrator/useOrchestrator.js'
22
+ import { useI18n } from '../../i18n/useI18n'
22
23
  import type { EntityManager } from '../../entity/EntityManager'
23
24
  import type { EntityRecord } from '../../types'
24
25
 
@@ -39,6 +40,7 @@ const props = defineProps<{
39
40
  const route = useRoute()
40
41
  const router = useRouter()
41
42
  const { getManager } = useOrchestrator()
43
+ const { tOr } = useI18n()
42
44
 
43
45
  // Parent config from route meta
44
46
  const parentConfig = computed<ParentConfig | undefined>(() => route.meta?.parent as ParentConfig | undefined)
@@ -156,7 +158,7 @@ const allNavlinks = computed<NavLink[]>(() => {
156
158
 
157
159
  // Details link to parent item page
158
160
  const detailsLink: NavLink = {
159
- label: 'Details',
161
+ label: tOr('breadcrumb.details', 'Details'),
160
162
  to: { name: parentRouteName ?? undefined, params: { [parentManager.idField]: parentId } },
161
163
  active: isOnParentRoute
162
164
  }
@@ -172,7 +174,7 @@ const allNavlinks = computed<NavLink[]>(() => {
172
174
  // Details link is optional since breadcrumb already shows current page
173
175
  if (props.showDetailsLink) {
174
176
  const detailsLink: NavLink = {
175
- label: 'Details',
177
+ label: tOr('breadcrumb.details', 'Details'),
176
178
  to: { name: route.name as string | undefined, params: route.params as Record<string, unknown> },
177
179
  active: true
178
180
  }
@@ -6,8 +6,10 @@
6
6
  */
7
7
  import { computed, type ComputedRef } from 'vue'
8
8
  import { useRouter, type RouteRecordName } from 'vue-router'
9
+ import { useI18n } from '../../i18n/useI18n'
9
10
 
10
11
  const router = useRouter()
12
+ const { tOr } = useI18n()
11
13
 
12
14
  const homeRoute: ComputedRef<RouteRecordName | string> = computed(() => {
13
15
  // Find home route (first route or named 'home'/'dashboard')
@@ -29,11 +31,11 @@ function goHome(): void {
29
31
  <div class="not-found-page">
30
32
  <div class="not-found-content">
31
33
  <div class="not-found-code">404</div>
32
- <h1>Page not found</h1>
33
- <p>The page you're looking for doesn't exist or has been moved.</p>
34
+ <h1>{{ tOr('core.notFound.title', 'Page not found') }}</h1>
35
+ <p>{{ tOr('core.notFound.message', "The page you're looking for doesn't exist or has been moved.") }}</p>
34
36
  <button class="home-link" @click="goHome">
35
37
  <i class="pi pi-home"></i>
36
- Back to Home
38
+ {{ tOr('core.notFound.home', 'Back to Home') }}
37
39
  </button>
38
40
  </div>
39
41
  </div>
@@ -69,7 +69,7 @@ const elapsed = computed(() => {
69
69
  <div v-if="run.step" class="qd-task-step">{{ run.step }}</div>
70
70
 
71
71
  <LogStream v-if="logSource" :key="run.id" class="qd-task-log" :source="logSource" height="16rem"
72
- error-pattern="error|fatal|failed" />
72
+ error-pattern="error|fatal|failed" @done="store.poke(run.id)" />
73
73
 
74
74
  <div v-if="run.status === 'failed' && run.error" class="qd-task-error"><i class="pi pi-exclamation-triangle" /> {{ run.error }}</div>
75
75
  <div v-else-if="!final && run.error" class="qd-task-warning">{{ t('core.task.readError', { error: run.error }) }}</div>
@@ -27,12 +27,13 @@ const typed = ref('')
27
27
  watch(pending, () => (typed.value = ''))
28
28
  const expected = computed(() => pending.value?.confirm.typed ?? null)
29
29
  const confirmable = computed(() => expected.value === null || typed.value === expected.value)
30
+ const severity = computed(() => pending.value?.confirm.severity ?? (expected.value !== null ? 'danger' : 'primary'))
30
31
  </script>
31
32
 
32
33
  <template>
33
34
  <TaskDialog :run-id="store.state.openId" @close="store.open(null)" />
34
35
  <SimpleDialog :visible="!!pending" :title="pending?.label ?? ''" :confirm-label="pending?.confirm.accept ?? t('core.task.start')"
35
- confirm-severity="danger" :confirm-disabled="!confirmable" :cancel-label="t('core.task.dontStart')"
36
+ :confirm-severity="severity" :confirm-disabled="!confirmable" :cancel-label="t('core.task.dontStart')"
36
37
  @confirm="store.answerConfirm(true)" @cancel="store.answerConfirm(false)"
37
38
  @update:visible="(v: boolean) => !v && pending && store.answerConfirm(false)">
38
39
  <p v-if="pending?.confirm.message" class="qd-task-confirm-message">{{ pending.confirm.message }}</p>
@@ -2,6 +2,7 @@ import { computed, inject, type ComputedRef, type Ref } from 'vue'
2
2
  import { useRouter } from 'vue-router'
3
3
  import { useSemanticBreadcrumb, type SemanticBreadcrumbItem } from './useSemanticBreadcrumb'
4
4
  import { useStackHydrator, type HydratedLevel } from '../chain/useStackHydrator'
5
+ import { useI18n } from '../i18n/useI18n'
5
6
 
6
7
  /**
7
8
  * Breadcrumb display item
@@ -59,14 +60,21 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
59
60
  // Get hydrator for parent entity labels
60
61
  const hydrator = useStackHydrator()
61
62
 
62
- // Default label mapping
63
- const defaultLabelMap: Record<string, string> = {
64
- home: 'Home',
65
- dashboard: 'Dashboard',
66
- create: 'Create',
67
- edit: 'Edit',
68
- show: 'View',
69
- delete: 'Delete',
63
+ // Default labels, from the i18n catalog (a custom labelMap entry wins)
64
+ const { tOr } = useI18n()
65
+ const defaultLabels: Record<string, [string, string]> = {
66
+ home: ['breadcrumb.home', 'Home'],
67
+ dashboard: ['breadcrumb.dashboard', 'Dashboard'],
68
+ create: ['core.actions.create', 'Create'],
69
+ edit: ['core.actions.edit', 'Edit'],
70
+ show: ['core.actions.view', 'View'],
71
+ delete: ['core.actions.delete', 'Delete'],
72
+ }
73
+ function label(key: string): string | undefined {
74
+ const custom = options.labelMap?.[key]
75
+ if (custom) return custom
76
+ const def = defaultLabels[key]
77
+ return def ? tOr(def[0], def[1]) : undefined
70
78
  }
71
79
 
72
80
  // Default icon mapping for entities
@@ -80,7 +88,6 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
80
88
  }
81
89
 
82
90
  // Merge with custom mappings
83
- const labelMap = { ...defaultLabelMap, ...options.labelMap }
84
91
  const iconMap = { ...defaultIconMap, ...options.iconMap }
85
92
 
86
93
  /**
@@ -133,7 +140,7 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
133
140
  if (item.kind === 'route') {
134
141
  // Generic route
135
142
  const routeName = item.route!
136
- displayItem.label = item.label || labelMap[routeName] || capitalize(routeName)
143
+ displayItem.label = item.label || label(routeName) || capitalize(routeName)
137
144
  displayItem.to = isLast ? null : routeExists(routeName) ? { name: routeName } : null
138
145
  if (routeName === 'home') {
139
146
  displayItem.icon = 'pi pi-home'
@@ -144,7 +151,7 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
144
151
 
145
152
  if (item.kind === 'entity-list') {
146
153
  // Entity list - use plural label
147
- displayItem.label = labelMap[entityName] || capitalize(entityName)
154
+ displayItem.label = label(entityName) || capitalize(entityName)
148
155
  displayItem.icon = index === 1 ? iconMap[entityName] || null : null
149
156
  const routeName = getEntityRouteName(entityName, item.kind)
150
157
  displayItem.to = isLast ? null : routeExists(routeName) ? { name: routeName } : null
@@ -177,7 +184,7 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
177
184
  }
178
185
  } else if (item.kind === 'entity-create') {
179
186
  // Create page - label as action
180
- displayItem.label = labelMap.create || 'Create'
187
+ displayItem.label = label('create')!
181
188
  }
182
189
  }
183
190
 
@@ -190,7 +197,7 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
190
197
  function getHomeItem(): BreadcrumbDisplayItem | null {
191
198
  if (!homeRouteName || !routeExists(homeRouteName)) return null
192
199
  return {
193
- label: labelMap.home || 'Home',
200
+ label: label('home')!,
194
201
  to: { name: homeRouteName },
195
202
  icon: 'pi pi-home',
196
203
  }
@@ -237,7 +244,7 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
237
244
  */
238
245
  function setBreadcrumb(items: BreadcrumbDisplayItem[]): BreadcrumbDisplayItem[] {
239
246
  const homeItem: BreadcrumbDisplayItem = {
240
- label: labelMap.home || 'Home',
247
+ label: label('home')!,
241
248
  to: { name: homeRouteName! },
242
249
  icon: 'pi pi-home',
243
250
  }
@@ -31,6 +31,7 @@ import { requireDeleteConfirmation } from './confirmDelete'
31
31
  import { useDirtyState } from './useDirtyState'
32
32
  import { useUnsavedChangesGuard, type GuardDialogState } from './useUnsavedChangesGuard'
33
33
  import { useBreadcrumb } from './useBreadcrumb'
34
+ import { useI18n } from '../i18n/useI18n'
34
35
  import {
35
36
  useEntityItemPage,
36
37
  type CreateContext,
@@ -130,6 +131,7 @@ export function useEntityItemFormPage<T extends Record<string, unknown> = Record
130
131
  const router = useRouter()
131
132
  const route = useRoute()
132
133
  const confirm = useConfirm() as ConfirmService
134
+ const { tOr } = useI18n()
133
135
  const debug = inject<boolean>('qdadmDebug', false)
134
136
  // Loads show as activity on the notification badge (#2677); a no-op without notifications.
135
137
  const notifications = useNotifications()
@@ -441,8 +443,8 @@ export function useEntityItemFormPage<T extends Record<string, unknown> = Record
441
443
  function confirmDelete(): void {
442
444
  const label = manager.getEntityLabel(data.value) || entityId.value
443
445
  requireDeleteConfirmation(confirm, {
444
- message: `Delete ${entityName} "${label}"?`,
445
- header: 'Confirm Delete',
446
+ message: tOr('core.messages.confirmDeleteItem', 'Delete {entity} "{label}"?', { entity: entityName, label: String(label) }),
447
+ header: tOr('core.messages.confirmDeleteTitle', 'Confirm Delete'),
446
448
  accept: remove,
447
449
  })
448
450
  }
@@ -766,7 +768,7 @@ export function useEntityItemFormPage<T extends Record<string, unknown> = Record
766
768
  }
767
769
 
768
770
  function addDeleteAction(options: AddDeleteActionOptions = {}): void {
769
- const { label = 'Delete' } = options
771
+ const { label = tOr('core.actions.delete', 'Delete') } = options
770
772
 
771
773
  addAction('delete', {
772
774
  label,
@@ -798,13 +800,14 @@ export function useEntityItemFormPage<T extends Record<string, unknown> = Record
798
800
  const pageTitle = computed(() => {
799
801
  if (isEdit.value) {
800
802
  const label = entityLabel.value
801
- return label ? `Edit ${entityName}: ${label}` : `Edit ${entityName}`
803
+ const action = tOr('core.actions.edit', 'Edit')
804
+ return label ? `${action} ${entityName}: ${label}` : `${action} ${entityName}`
802
805
  }
803
- return `Create ${entityName}`
806
+ return `${tOr('core.actions.create', 'Create')} ${entityName}`
804
807
  })
805
808
 
806
809
  const pageTitleParts = computed<PageTitleParts>(() => ({
807
- action: isEdit.value ? 'Edit' : 'Create',
810
+ action: isEdit.value ? tOr('core.actions.edit', 'Edit') : tOr('core.actions.create', 'Create'),
808
811
  entityName,
809
812
  entityLabel: isEdit.value ? entityLabel.value : undefined,
810
813
  }))
@@ -39,6 +39,7 @@ import { useRouter, useRoute, type Router } from 'vue-router'
39
39
  import { useNotifications } from '../notifications/NotificationStore'
40
40
  import { useConfirm } from 'primevue/useconfirm'
41
41
  import { requireDeleteConfirmation } from './confirmDelete'
42
+ import { useI18n } from '../i18n/useI18n'
42
43
  import {
43
44
  useEntityItemPage,
44
45
  type ParentConfig,
@@ -270,6 +271,7 @@ export function useEntityItemShowPage<T = Record<string, unknown>>(
270
271
 
271
272
  const router: Router = useRouter()
272
273
  const confirm = useConfirm() as ConfirmService
274
+ const { tOr } = useI18n()
273
275
 
274
276
  // Lazy action state (declared before base so onLoadSuccess wrapper can reference it)
275
277
  const lazyActionsMap = ref<Map<string, LazyActionConfig>>(new Map())
@@ -441,7 +443,7 @@ export function useEntityItemShowPage<T = Record<string, unknown>>(
441
443
  }
442
444
 
443
445
  function addEditAction(editOptions: { label?: string; icon?: string } = {}): UseEntityItemShowPageReturn<T> {
444
- const { label = 'Edit', icon = 'pi pi-pencil' } = editOptions
446
+ const { label = tOr('core.actions.edit', 'Edit'), icon = 'pi pi-pencil' } = editOptions
445
447
  return addAction({
446
448
  name: 'edit',
447
449
  label,
@@ -455,7 +457,7 @@ export function useEntityItemShowPage<T = Record<string, unknown>>(
455
457
  function addDeleteAction(
456
458
  deleteOptions: { label?: string; icon?: string; confirm?: boolean } = {}
457
459
  ): UseEntityItemShowPageReturn<T> {
458
- const { label = 'Delete', icon = 'pi pi-trash', confirm: confirmDelete = true } = deleteOptions
460
+ const { label = tOr('core.actions.delete', 'Delete'), icon = 'pi pi-trash', confirm: confirmDelete = true } = deleteOptions
459
461
  return addAction({
460
462
  name: 'delete',
461
463
  label,
@@ -464,8 +466,8 @@ export function useEntityItemShowPage<T = Record<string, unknown>>(
464
466
  onClick: () => {
465
467
  if (confirmDelete) {
466
468
  requireDeleteConfirmation(confirm, {
467
- message: `Are you sure you want to delete this ${manager.label || entity}?`,
468
- header: 'Confirm Delete',
469
+ message: tOr('core.messages.confirmDeleteThis', 'Are you sure you want to delete this {entity}?', { entity: manager.label || entity }),
470
+ header: tOr('core.messages.confirmDeleteTitle', 'Confirm Delete'),
469
471
  accept: () => deleteEntity(),
470
472
  })
471
473
  } else {
@@ -477,7 +479,7 @@ export function useEntityItemShowPage<T = Record<string, unknown>>(
477
479
  }
478
480
 
479
481
  function addBackAction(backOptions: { label?: string; icon?: string; route?: string } = {}): UseEntityItemShowPageReturn<T> {
480
- const { label = 'Back', icon = 'pi pi-arrow-left', route: backRoute } = backOptions
482
+ const { label = tOr('core.actions.back', 'Back'), icon = 'pi pi-arrow-left', route: backRoute } = backOptions
481
483
  return addAction({
482
484
  name: 'back',
483
485
  label,
@@ -532,7 +534,7 @@ export function useEntityItemShowPage<T = Record<string, unknown>>(
532
534
  // ============ PAGE TITLE ============
533
535
 
534
536
  const titleParts = computed<PageTitleParts>(() => ({
535
- action: 'View',
537
+ action: tOr('core.actions.view', 'View'),
536
538
  entityName: manager.label || entity,
537
539
  entityLabel: entityLabel.value || undefined,
538
540
  }))
@@ -151,7 +151,7 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
151
151
  const isMobile = ref(window.innerWidth < 768)
152
152
 
153
153
  // i18n integration — column headers resolve via entities.{entity}.fields.{field}
154
- const { i18n: kernelI18n, locale: i18nLocale } = useI18n()
154
+ const { i18n: kernelI18n, locale: i18nLocale, tOr } = useI18n()
155
155
 
156
156
  // Get EntityManager via orchestrator (#1193 — canonical injection: one
157
157
  // error-message source; erased to this file's Read-tier view)
@@ -1059,8 +1059,11 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
1059
1059
  function confirmDelete(item: unknown, labelField = 'name'): void {
1060
1060
  const itemRecord = item as Record<string, unknown>
1061
1061
  requireDeleteConfirmation(confirm, {
1062
- message: `Delete ${entityName} "${itemRecord[labelField] || itemRecord[resolvedDataKey]}"?`,
1063
- header: 'Confirm Delete',
1062
+ message: tOr('core.messages.confirmDeleteItem', 'Delete {entity} "{label}"?', {
1063
+ entity: entityName,
1064
+ label: String(itemRecord[labelField] || itemRecord[resolvedDataKey]),
1065
+ }),
1066
+ header: tOr('core.messages.confirmDeleteTitle', 'Confirm Delete'),
1064
1067
  accept: () => deleteItem(item, labelField),
1065
1068
  })
1066
1069
  }
@@ -1243,7 +1246,7 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
1243
1246
  function addViewAction(options: Partial<ActionConfig> = {}): void {
1244
1247
  addAction('view', {
1245
1248
  icon: 'pi pi-eye',
1246
- tooltip: 'View',
1249
+ tooltip: tOr('core.actions.view', 'View'),
1247
1250
  onClick: options.onClick || goToShow,
1248
1251
  ...options,
1249
1252
  })
@@ -1252,7 +1255,7 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
1252
1255
  function addEditAction(options: Partial<ActionConfig> = {}): void {
1253
1256
  addAction('edit', {
1254
1257
  icon: 'pi pi-pencil',
1255
- tooltip: 'Edit',
1258
+ tooltip: tOr('core.actions.edit', 'Edit'),
1256
1259
  onClick: options.onClick || goToEdit,
1257
1260
  visible: (row) => manager.canUpdate(row),
1258
1261
  ...options,
@@ -1263,7 +1266,7 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
1263
1266
  const labelField = options.labelField || 'name'
1264
1267
  addAction('delete', {
1265
1268
  icon: 'pi pi-trash',
1266
- tooltip: 'Delete',
1269
+ tooltip: tOr('core.actions.delete', 'Delete'),
1267
1270
  severity: 'danger',
1268
1271
  onClick: (row) => confirmDelete(row, labelField),
1269
1272
  visible: (row) => manager.canDelete(row),
@@ -153,7 +153,7 @@ export function useNavContext(_options: UseNavContextOptions = {}): UseNavContex
153
153
  const hydrator = useStackHydrator()
154
154
 
155
155
  // i18n for the mode-toggle labels (no-op shim outside a kernel)
156
- const { i18n: kernelI18n, locale: i18nLocale } = useI18n()
156
+ const { tOr, locale: i18nLocale } = useI18n()
157
157
 
158
158
  function getManager(entityName: string): EntityManager | null {
159
159
  return orchestrator?.get(entityName) ?? null
@@ -224,7 +224,7 @@ export function useNavContext(_options: UseNavContextOptions = {}): UseNavContex
224
224
  type: 'create',
225
225
  entity: item.entity,
226
226
  manager,
227
- label: 'Create',
227
+ label: tOr('core.actions.create', 'Create'),
228
228
  routeName: manager ? `${manager.routePrefix}-create` : null,
229
229
  })
230
230
  } else if (item.kind === 'route') {
@@ -302,7 +302,7 @@ export function useNavContext(_options: UseNavContextOptions = {}): UseNavContex
302
302
  const homeItem = computed(() => {
303
303
  if (!homeRouteName || !routeExists(homeRouteName)) return null
304
304
  return {
305
- label: homeRouteName === 'dashboard' ? 'Dashboard' : 'Home',
305
+ label: homeRouteName === 'dashboard' ? breadcrumbLabel('dashboard', 'Dashboard') : breadcrumbLabel('home', 'Home'),
306
306
  to: { name: homeRouteName },
307
307
  icon: 'pi pi-home',
308
308
  }
@@ -461,9 +461,7 @@ export function useNavContext(_options: UseNavContextOptions = {}): UseNavContex
461
461
 
462
462
  /** Resolve a `breadcrumb.*` label from the i18n catalog, with fallback. */
463
463
  function breadcrumbLabel(key: string, fallback: string): string {
464
- const trace = kernelI18n?.resolve(`breadcrumb.${key}`)
465
- if (trace?.hit) return trace.result
466
- return fallback
464
+ return tOr(`breadcrumb.${key}`, fallback)
467
465
  }
468
466
 
469
467
  function toggleLabel(target: 'show' | 'edit'): string {
@@ -198,3 +198,17 @@ describe('I18n — dump', () => {
198
198
  expect(dumped.core).toBeUndefined()
199
199
  })
200
200
  })
201
+
202
+ describe('I18n — plural forms in the core bundle (#4147)', () => {
203
+ it('reads the singular for one, by the locale rules', async () => {
204
+ const fr = new I18n({ defaultLocale: 'fr' })
205
+ await fr.bootstrap()
206
+ expect(fr.t('core.task.tray', { count: 1 })).toBe('1 tâche en cours')
207
+ expect(fr.t('core.task.tray', { count: 0 })).toBe('0 tâche en cours')
208
+ expect(fr.t('core.log.lines', { count: 12 })).toBe('12 lignes')
209
+ const en = new I18n()
210
+ await en.bootstrap()
211
+ expect(en.t('core.log.errors', { count: 1 })).toBe('1 error')
212
+ expect(en.t('core.log.errors', { count: 0 })).toBe('0 errors')
213
+ })
214
+ })
@@ -45,7 +45,7 @@ describe('i18n default providers — generated/.yml sync', () => {
45
45
  const provider = createDefaultCoreProvider()
46
46
  const en = (await provider.load('en')) as BreadcrumbBundle
47
47
  const fr = (await provider.load('fr')) as BreadcrumbBundle
48
- expect(en.breadcrumb).toEqual({ view: 'View', edit: 'Edit' })
49
- expect(fr.breadcrumb).toEqual({ view: 'Voir', edit: 'Modifier' })
48
+ expect(en.breadcrumb).toEqual({ home: 'Home', dashboard: 'Dashboard', details: 'Details', view: 'View', edit: 'Edit' })
49
+ expect(fr.breadcrumb).toEqual({ home: 'Accueil', dashboard: 'Tableau de bord', details: 'Détails', view: 'Voir', edit: 'Modifier' })
50
50
  })
51
51
  })