@jskit-ai/shell-web 0.1.255 → 0.2.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,50 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 - 2026-10-29
4
+
5
+ - Translation ready: every user-visible text is a message key with its English in `locales/en.json`, so an app translates it by supplying translation files only. With no translations, texts and behaviour are unchanged. See the guide "Translating a JSKIT app".
6
+ - The error host, menus, navigation and not-found/loading screens are translated; placement `label`/`title` may be a key, `{ key, fallback, params }` or plain text.
7
+
8
+ ### New message keys (31)
9
+
10
+ All keys in `locales/en.json` (exported as `./locales/en.json`) are new in this version.
11
+
12
+ <details><summary>Key list</summary>
13
+
14
+ - `jskit.shell.actions.close`
15
+ - `jskit.shell.actions.dismiss`
16
+ - `jskit.shell.actions.reload`
17
+ - `jskit.shell.actions.retry`
18
+ - `jskit.shell.error.actionFailed`
19
+ - `jskit.shell.error.attentionRequired`
20
+ - `jskit.shell.error.navigationFailed`
21
+ - `jskit.shell.error.requestFailed`
22
+ - `jskit.shell.error.unexpectedUi`
23
+ - `jskit.shell.layout.closeNavigationMenu`
24
+ - `jskit.shell.layout.collapseNavigationDrawer`
25
+ - `jskit.shell.layout.details`
26
+ - `jskit.shell.layout.expandNavigationDrawer`
27
+ - `jskit.shell.layout.openNavigationMenu`
28
+ - `jskit.shell.layout.surface`
29
+ - `jskit.shell.layout.tab`
30
+ - `jskit.shell.layout.tools`
31
+ - `jskit.shell.pullToRefresh.pull`
32
+ - `jskit.shell.pullToRefresh.refreshing`
33
+ - `jskit.shell.pullToRefresh.release`
34
+ - `jskit.shell.recovery.appDataLabel`
35
+ - `jskit.shell.recovery.appLabel`
36
+ - `jskit.shell.recovery.appModuleLabel`
37
+ - `jskit.shell.recovery.appUnreachable`
38
+ - `jskit.shell.recovery.errorConfigLabel`
39
+ - `jskit.shell.recovery.moduleFailed`
40
+ - `jskit.shell.recovery.placementConfigLabel`
41
+ - `jskit.shell.recovery.placementTopologyLabel`
42
+ - `jskit.shell.recovery.refreshFailed`
43
+ - `jskit.shell.recovery.reloadFailed`
44
+ - `jskit.shell.recovery.unreachable`
45
+
46
+ </details>
47
+
3
48
  ## 0.1.152 - 2026-08-13
4
49
 
5
50
  - Remove the redundant uppercase surface subheader from the expanded drawer; the top app bar remains the single shell-owned surface label.
@@ -0,0 +1,49 @@
1
+ {
2
+ "jskit": {
3
+ "shell": {
4
+ "actions": {
5
+ "close": "Close",
6
+ "dismiss": "Dismiss",
7
+ "reload": "Reload",
8
+ "retry": "Retry"
9
+ },
10
+ "error": {
11
+ "actionFailed": "Error action failed.",
12
+ "attentionRequired": "Attention required",
13
+ "navigationFailed": "Navigation failed.",
14
+ "requestFailed": "Request failed.",
15
+ "unexpectedUi": "Unexpected UI error."
16
+ },
17
+ "layout": {
18
+ "closeNavigationMenu": "Close navigation menu",
19
+ "collapseNavigationDrawer": "Collapse navigation drawer",
20
+ "details": "Details",
21
+ "expandNavigationDrawer": "Expand navigation drawer",
22
+ "openNavigationMenu": "Open navigation menu",
23
+ "surface": "Surface",
24
+ "tab": "Tab",
25
+ "tools": "Tools"
26
+ },
27
+ "pullToRefresh": {
28
+ "pull": "Pull to refresh",
29
+ "refreshing": "Refreshing",
30
+ "release": "Release to refresh"
31
+ },
32
+ "recovery": {
33
+ "appDataLabel": "App data",
34
+ "appLabel": "App",
35
+ "appModuleLabel": "App module",
36
+ "appUnreachable": "The app could not reach the server or network. Check the connection and try again.",
37
+ "appUpdated": "{app} was updated. Reload to get the latest version.",
38
+ "errorConfigLabel": "Error config",
39
+ "moduleFailed": "A required app module could not load.",
40
+ "placementConfigLabel": "Placement config",
41
+ "placementTopologyLabel": "Placement topology",
42
+ "refreshFailed": "Unable to refresh. Check the connection and try again.",
43
+ "reloadFailed": "The app cannot reload because the app server is not reachable. Restart the server, then click Reload.",
44
+ "thisAppUpdated": "This app was updated. Reload to get the latest version.",
45
+ "unreachable": "{label} could not reach the server or network. Check the connection and try again."
46
+ }
47
+ }
48
+ }
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/shell-web",
3
- "version": "0.1.255",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test --test-concurrency=1"
@@ -26,7 +26,8 @@
26
26
  "./client/composables/useShellLayoutState": "./src/client/composables/useShellLayoutState.js",
27
27
  "./client/providers/ShellWebClientProvider": "./src/client/providers/ShellWebClientProvider.js",
28
28
  "./test/adaptiveShellSmoke": "./src/test/adaptiveShellSmoke.js",
29
- "./architecture": "./src/architecture/inspectVueArchitecture.js"
29
+ "./architecture": "./src/architecture/inspectVueArchitecture.js",
30
+ "./locales/en.json": "./locales/en.json"
30
31
  },
31
32
  "dependencies": {
32
33
  "@jskit-ai/architecture-inspector": "0.1.0",
@@ -36,7 +37,7 @@
36
37
  "@vue/compiler-sfc": "3.5.44"
37
38
  },
38
39
  "peerDependencies": {
39
- "@jskit-ai/kernel": "0.1.248",
40
+ "@jskit-ai/kernel": "0.2.1",
40
41
  "pinia": "^4.0.3",
41
42
  "vue": "^3.5.44",
42
43
  "vue-router": "^5.3.1",
@@ -6,7 +6,10 @@ import {
6
6
  notifyAsyncModuleLoadError
7
7
  } from "@jskit-ai/kernel/client/asyncModuleRecovery";
8
8
  import { createProviderLogger as createSharedProviderLogger } from "@jskit-ai/kernel/shared/support/providerLogger";
9
- import { APP_RELOAD_FAILURE_MESSAGE } from "../requestRecovery/runtime.js";
9
+ import { appReloadFailureMessage } from "../requestRecovery/runtime.js";
10
+ import { useJskitText } from "../i18n.js";
11
+
12
+ const { t } = useJskitText();
10
13
 
11
14
  function createShellAsyncModuleRecoveryRuntime({
12
15
  router = null,
@@ -31,13 +34,17 @@ function createShellAsyncModuleRecoveryRuntime({
31
34
  try {
32
35
  return errorRuntime.report({
33
36
  source: "shell-web.async-module-recovery",
34
- message: String(nextState?.message || "A required app module could not load."),
37
+ message: String(nextState?.message || t("jskit.shell.recovery.moduleFailed")),
38
+ // The kernel's sentence for this failure, so the whole message is translated.
39
+ ...(nextState?.message && nextState?.messageCode
40
+ ? { messageCode: nextState.messageCode, messageParams: nextState.messageParams }
41
+ : {}),
35
42
  cause: nextState?.error || null,
36
43
  intent: "app-recoverable",
37
44
  severity: "warning",
38
45
  dedupeKey: `shell-web.async-module-recovery.${Number(nextState?.attempt || 0)}`,
39
46
  action: {
40
- label: "Reload",
47
+ label: t("jskit.shell.actions.reload"),
41
48
  dismissOnRun: true,
42
49
  handler() {
43
50
  return reload();
@@ -59,8 +66,8 @@ function createShellAsyncModuleRecoveryRuntime({
59
66
  async function reload() {
60
67
  const reloaded = await guardedReloadApp({
61
68
  state,
62
- label: "App",
63
- message: APP_RELOAD_FAILURE_MESSAGE
69
+ label: t("jskit.shell.recovery.appLabel"),
70
+ message: appReloadFailureMessage()
64
71
  });
65
72
  if (!reloaded) {
66
73
  report(state);
@@ -69,7 +76,7 @@ function createShellAsyncModuleRecoveryRuntime({
69
76
  }
70
77
 
71
78
  function notify(error = null, {
72
- label = "App module",
79
+ label = t("jskit.shell.recovery.appModuleLabel"),
73
80
  message = "",
74
81
  stale = isDynamicImportError(error)
75
82
  } = {}) {
@@ -89,7 +96,7 @@ function createShellAsyncModuleRecoveryRuntime({
89
96
 
90
97
  installedRecovery = installAsyncModuleRecoveryHandlers({
91
98
  state,
92
- label: "App module",
99
+ label: t("jskit.shell.recovery.appModuleLabel"),
93
100
  router,
94
101
  onNotify: report
95
102
  });
@@ -0,0 +1,86 @@
1
+ import { pageClientBuildId } from "@jskit-ai/kernel/shared/support/clientBuild";
2
+ import { normalizeText } from "@jskit-ai/kernel/shared/support/normalize";
3
+ import { useJskitText } from "../i18n.js";
4
+
5
+ const { t } = useJskitText();
6
+
7
+ // The title the page loaded with (index.html's <title>) names the app; screens
8
+ // may change the tab title later.
9
+ function loadedAppName(documentObject = globalThis.document) {
10
+ return normalizeText(documentObject?.title);
11
+ }
12
+
13
+ // Offers a reload when the server serves a different client build from the one
14
+ // this page runs, as it does after an update. It never reloads by itself: the
15
+ // person may be in the middle of something. Reload returns to the same address.
16
+ function createShellClientUpdateRuntime({
17
+ errorRuntime,
18
+ reload,
19
+ pageBuildId = pageClientBuildId(),
20
+ appName = loadedAppName()
21
+ } = {}) {
22
+ let offer = null;
23
+ let stopWatching = null;
24
+
25
+ function withdraw() {
26
+ if (offer?.presentationId) {
27
+ errorRuntime.dismiss(offer.presentationId);
28
+ }
29
+ offer = null;
30
+ }
31
+
32
+ function offerReload(servedBuildId) {
33
+ const [messageKey, messageParams] = appName
34
+ ? ["jskit.shell.recovery.appUpdated", { app: appName }]
35
+ : ["jskit.shell.recovery.thisAppUpdated", {}];
36
+ const result = errorRuntime.report({
37
+ source: "shell-web.client-update",
38
+ message: t(messageKey, messageParams),
39
+ // The error host renders the sentence in the user's language from its code.
40
+ messageCode: messageKey.slice("jskit.".length),
41
+ messageParams,
42
+ intent: "app-recoverable",
43
+ severity: "info",
44
+ action: {
45
+ label: t("jskit.shell.actions.reload"),
46
+ handler() {
47
+ return reload();
48
+ }
49
+ }
50
+ });
51
+ offer = { buildId: servedBuildId, presentationId: normalizeText(result?.presentationId) };
52
+ }
53
+
54
+ // One offer per served build: a reconnection to the same build does not
55
+ // repeat it, even after the person closed it.
56
+ function check(servedBuildId = "") {
57
+ const served = normalizeText(servedBuildId);
58
+ if (!pageBuildId || !served || served === offer?.buildId) {
59
+ return;
60
+ }
61
+ withdraw();
62
+ if (served !== pageBuildId) {
63
+ offerReload(served);
64
+ }
65
+ }
66
+
67
+ // realtime is the optional client.realtime capability, which names the
68
+ // server's build on every connection.
69
+ function watch(realtime = null) {
70
+ dispose();
71
+ stopWatching = realtime ? realtime.onServedClientBuild(check) : null;
72
+ }
73
+
74
+ function dispose() {
75
+ stopWatching?.();
76
+ stopWatching = null;
77
+ }
78
+
79
+ return Object.freeze({
80
+ check,
81
+ dispose,
82
+ watch
83
+ });
84
+ }
85
+
86
+ export { createShellClientUpdateRuntime };
@@ -6,8 +6,12 @@ import {
6
6
  useShellWebErrorRuntime
7
7
  } from "../error/inject.js";
8
8
  import { useShellErrorPresentationStore } from "../stores/useShellErrorPresentationStore.js";
9
+ import { useJskitText } from "../i18n.js";
9
10
 
10
11
  const runtime = useShellWebErrorRuntime();
12
+ // Entries keep the server's code and params, so an API error shows in the
13
+ // user's language; anything else shows as reported.
14
+ const { t, text, serverMessage } = useJskitText();
11
15
  const store = useShellErrorPresentationStore();
12
16
 
13
17
  const snackbarEntries = computed(() => store.channels.snackbar || []);
@@ -188,7 +192,7 @@ async function runAction(entry, action) {
188
192
  } catch (error) {
189
193
  runtime.report({
190
194
  source: "shell-web.error-host.action",
191
- message: "Error action failed.",
195
+ message: t("jskit.shell.error.actionFailed"),
192
196
  cause: error,
193
197
  intent: "blocking",
194
198
  severity: "error"
@@ -248,10 +252,11 @@ function onSnackbarAfterLeave() {
248
252
  border="start"
249
253
  class="shell-error-host__banner"
250
254
  closable
255
+ :close-label="t('jskit.shell.actions.close')"
251
256
  @click:close="dismiss(entry)"
252
257
  >
253
258
  <div class="d-flex align-center ga-3 flex-wrap">
254
- <span>{{ entry.message }}</span>
259
+ <span>{{ serverMessage(entry) }}</span>
255
260
  <v-spacer />
256
261
  <v-btn
257
262
  v-for="(action, index) in actionsFor(entry)"
@@ -261,7 +266,7 @@ function onSnackbarAfterLeave() {
261
266
  class="text-none"
262
267
  @click="runAction(entry, action)"
263
268
  >
264
- {{ action.label }}
269
+ {{ text(action.label) }}
265
270
  </v-btn>
266
271
  </div>
267
272
  </v-alert>
@@ -277,7 +282,7 @@ function onSnackbarAfterLeave() {
277
282
  @update:model-value="onSnackbarModelValue"
278
283
  @after-leave="onSnackbarAfterLeave"
279
284
  >
280
- <span v-if="displayedSnackbarEntry">{{ displayedSnackbarEntry.message }}</span>
285
+ <span v-if="displayedSnackbarEntry">{{ serverMessage(displayedSnackbarEntry) }}</span>
281
286
 
282
287
  <template #actions>
283
288
  <v-btn
@@ -287,7 +292,7 @@ function onSnackbarAfterLeave() {
287
292
  min-height="48"
288
293
  @click="runAction(displayedSnackbarEntry, action)"
289
294
  >
290
- {{ action.label }}
295
+ {{ text(action.label) }}
291
296
  </v-btn>
292
297
  <v-btn
293
298
  v-if="displayedSnackbarEntry"
@@ -295,7 +300,7 @@ function onSnackbarAfterLeave() {
295
300
  size="small"
296
301
  @click="dismiss(displayedSnackbarEntry)"
297
302
  >
298
- Dismiss
303
+ {{ t("jskit.shell.actions.dismiss") }}
299
304
  </v-btn>
300
305
  </template>
301
306
  </v-snackbar>
@@ -307,8 +312,8 @@ function onSnackbarAfterLeave() {
307
312
  @update:model-value="onDialogModelValue"
308
313
  >
309
314
  <v-card v-if="dialogEntry">
310
- <v-card-title class="text-subtitle-1">Attention required</v-card-title>
311
- <v-card-text>{{ dialogEntry.message }}</v-card-text>
315
+ <v-card-title class="text-subtitle-1">{{ t("jskit.shell.error.attentionRequired") }}</v-card-title>
316
+ <v-card-text>{{ serverMessage(dialogEntry) }}</v-card-text>
312
317
  <v-card-actions>
313
318
  <v-spacer />
314
319
  <v-btn
@@ -317,14 +322,14 @@ function onSnackbarAfterLeave() {
317
322
  variant="text"
318
323
  @click="runAction(dialogEntry, action)"
319
324
  >
320
- {{ action.label }}
325
+ {{ text(action.label) }}
321
326
  </v-btn>
322
327
  <v-btn
323
328
  color="primary"
324
329
  variant="tonal"
325
330
  @click="dismiss(dialogEntry)"
326
331
  >
327
- Close
332
+ {{ t("jskit.shell.actions.close") }}
328
333
  </v-btn>
329
334
  </v-card-actions>
330
335
  </v-card>
@@ -28,6 +28,9 @@ import { readViewportWidth, resolveShellLayoutClass } from "../support/shellLayo
28
28
  import { SHELL_WEB_REFRESH_RUNTIME_KEY } from "../runtime/refreshRuntime.js";
29
29
  import ShellOutlet from "./ShellOutlet.vue";
30
30
  import ShellRouteTransition from "./ShellRouteTransition.vue";
31
+ import { useJskitText } from "../i18n.js";
32
+
33
+ const { t, text } = useJskitText();
31
34
 
32
35
  const props = defineProps({
33
36
  surface: {
@@ -386,8 +389,8 @@ function handleDrawerVisibilityChange(open) {
386
389
 
387
390
  <v-main class="bg-background">
388
391
  <v-container fluid class="shell-layout__content">
389
- <h1 v-if="title" class="shell-layout__title text-h5">{{ title }}</h1>
390
- <p v-if="subtitle" class="shell-layout__subtitle text-body-2 text-medium-emphasis">{{ subtitle }}</p>
392
+ <h1 v-if="title" class="shell-layout__title text-h5">{{ text(title) }}</h1>
393
+ <p v-if="subtitle" class="shell-layout__subtitle text-body-2 text-medium-emphasis">{{ text(subtitle) }}</p>
391
394
  <ShellRouteTransition>
392
395
  <slot />
393
396
  </ShellRouteTransition>
@@ -413,8 +416,8 @@ function handleDrawerVisibilityChange(open) {
413
416
  >
414
417
  <v-card rounded="t-xl" class="shell-layout__supporting-sheet" data-testid="jskit-shell-supporting-bottom-sheet">
415
418
  <v-card-title class="shell-layout__supporting-title">
416
- <span>{{ supportingContentTitle || 'Details' }}</span>
417
- <v-btn variant="text" @click="closeSupportingContent">Close</v-btn>
419
+ <span>{{ text(supportingContentTitle) || t("jskit.shell.layout.details") }}</span>
420
+ <v-btn variant="text" @click="closeSupportingContent">{{ t("jskit.shell.actions.close") }}</v-btn>
418
421
  </v-card-title>
419
422
  <v-card-text>
420
423
  <ShellOutlet target="shell-layout:supporting-bottom-sheet" />
@@ -434,8 +437,8 @@ function handleDrawerVisibilityChange(open) {
434
437
  >
435
438
  <div class="shell-layout__supporting-side-panel">
436
439
  <div class="shell-layout__supporting-title">
437
- <strong>{{ supportingContentTitle || 'Details' }}</strong>
438
- <v-btn variant="text" @click="closeSupportingContent">Close</v-btn>
440
+ <strong>{{ text(supportingContentTitle) || t("jskit.shell.layout.details") }}</strong>
441
+ <v-btn variant="text" @click="closeSupportingContent">{{ t("jskit.shell.actions.close") }}</v-btn>
439
442
  </div>
440
443
  <ShellOutlet target="shell-layout:supporting-side-panel" />
441
444
  </div>
@@ -5,10 +5,12 @@ import { resolveMenuLinkIcon } from "../lib/menuIcons.js";
5
5
  import { resolveMenuLinkHref } from "../support/menuLinkTarget.js";
6
6
  import { activateShellNavigationLinkOnSpace } from "../support/navigationLinkKeyboard.js";
7
7
  import ShellNavigationTooltip from "./ShellNavigationTooltip.vue";
8
+ import { useJskitText } from "../i18n.js";
8
9
 
10
+ // The label may be a message key, { key, fallback } or plain text.
9
11
  const props = defineProps({
10
12
  label: {
11
- type: String,
13
+ type: [String, Object],
12
14
  default: ""
13
15
  },
14
16
  to: {
@@ -30,31 +32,34 @@ const props = defineProps({
30
32
  });
31
33
 
32
34
  const { context: placementContext } = useWebPlacementContext();
35
+ const { text } = useJskitText();
36
+ const resolvedLabel = computed(() => text(props.label));
33
37
 
34
38
  const resolvedTarget = computed(() => resolveMenuLinkHref(placementContext.value, props.to));
35
39
 
36
40
  const resolvedIcon = computed(() =>
37
41
  resolveMenuLinkIcon({
38
42
  icon: props.icon,
39
- label: props.label,
43
+ // Icons follow the English label, so they do not change with the language.
44
+ label: text(props.label, { locale: "en" }),
40
45
  to: resolvedTarget.value.href || props.to
41
46
  })
42
47
  );
43
48
  </script>
44
49
 
45
50
  <template>
46
- <ShellNavigationTooltip v-if="resolvedTarget.href" :label="props.label">
51
+ <ShellNavigationTooltip v-if="resolvedTarget.href" :label="resolvedLabel">
47
52
  <template #default="{ activatorProps }">
48
53
  <v-list-item
49
54
  v-bind="activatorProps"
50
55
  class="shell-menu-link-item"
51
- :title="props.label"
56
+ :title="resolvedLabel"
52
57
  :to="resolvedTarget.sameOrigin ? resolvedTarget.href : undefined"
53
58
  :href="resolvedTarget.sameOrigin ? undefined : resolvedTarget.href"
54
59
  :prepend-icon="resolvedIcon || undefined"
55
60
  :disabled="props.disabled"
56
61
  :exact="props.exact"
57
- :aria-label="props.label"
62
+ :aria-label="resolvedLabel"
58
63
  @keydown.space="activateShellNavigationLinkOnSpace"
59
64
  />
60
65
  </template>
@@ -1,19 +1,21 @@
1
1
  <script setup>
2
2
  import { useTheme } from "vuetify";
3
+ import { useJskitText } from "../i18n.js";
3
4
 
4
5
  const props = defineProps({
5
6
  label: {
6
- type: String,
7
+ type: [String, Object],
7
8
  default: ""
8
9
  }
9
10
  });
10
11
 
11
12
  const theme = useTheme();
13
+ const { text } = useJskitText();
12
14
  </script>
13
15
 
14
16
  <template>
15
17
  <v-tooltip
16
- :text="props.label"
18
+ :text="text(props.label)"
17
19
  :theme="theme.name.value"
18
20
  location="end"
19
21
  content-class="shell-navigation-tooltip"
@@ -14,6 +14,7 @@ import {
14
14
  resolveSurfaceIdFromPlacementPathname
15
15
  } from "../placement/surfaceContext.js";
16
16
  import { readViewportWidth, resolveShellLayoutClass } from "../support/shellLayoutClass.js";
17
+ import { useJskitText } from "../i18n.js";
17
18
 
18
19
  const props = defineProps({
19
20
  target: {
@@ -44,6 +45,29 @@ try {
44
45
  display = null;
45
46
  }
46
47
 
48
+ const { text } = useJskitText();
49
+ const TRANSLATED_PLACEMENT_PROPS = Object.freeze(["label", "title"]);
50
+
51
+ function isPlacementText(value) {
52
+ return typeof value === "string" || (Boolean(value) && typeof value === "object" && typeof value.key === "string");
53
+ }
54
+
55
+ // A placement's label and title may be message keys or { key, fallback }; they
56
+ // reach the component in the active language. Plain text passes unchanged.
57
+ function placementProps(entry) {
58
+ const source = entry?.props;
59
+ if (!source || typeof source !== "object") {
60
+ return source;
61
+ }
62
+ const translated = { ...source };
63
+ for (const name of TRANSLATED_PLACEMENT_PROPS) {
64
+ if (isPlacementText(source[name])) {
65
+ translated[name] = text(source[name]);
66
+ }
67
+ }
68
+ return translated;
69
+ }
70
+
47
71
  const placementRuntime = useWebPlacementRuntime();
48
72
  const { context: placementContext } = useWebPlacementContext();
49
73
  const revision = ref(
@@ -105,6 +129,6 @@ const placements = computed(() => {
105
129
  :is="entry.component"
106
130
  v-for="entry in placements"
107
131
  :key="entry.id"
108
- v-bind="entry.props"
132
+ v-bind="placementProps(entry)"
109
133
  />
110
134
  </template>
@@ -1,6 +1,9 @@
1
1
  <script setup>
2
2
  import { mdiCogOutline } from "@mdi/js";
3
3
  import ShellOutlet from "./ShellOutlet.vue";
4
+ import { useJskitText } from "../i18n.js";
5
+
6
+ const { t, text } = useJskitText();
4
7
 
5
8
  const props = defineProps({
6
9
  target: {
@@ -11,9 +14,10 @@ const props = defineProps({
11
14
  type: String,
12
15
  default: mdiCogOutline
13
16
  },
17
+ // Defaults to the translated "Tools"; a passed label may be a message key.
14
18
  ariaLabel: {
15
19
  type: String,
16
- default: "Tools"
20
+ default: undefined
17
21
  },
18
22
  location: {
19
23
  type: String,
@@ -37,7 +41,7 @@ const props = defineProps({
37
41
  v-bind="activatorProps"
38
42
  icon
39
43
  variant="text"
40
- :aria-label="props.ariaLabel"
44
+ :aria-label="props.ariaLabel === undefined ? t('jskit.shell.layout.tools') : text(props.ariaLabel)"
41
45
  >
42
46
  <v-icon :icon="props.icon" />
43
47
  </v-btn>
@@ -7,22 +7,22 @@ import { activateShellNavigationLinkOnSpace } from "../support/navigationLinkKey
7
7
  import ShellNavigationTooltip from "./ShellNavigationTooltip.vue";
8
8
 
9
9
  const props = defineProps(shellNavigationLinkProps);
10
- const { resolvedTarget, resolvedIcon } = useShellNavigationLink(props);
10
+ const { resolvedLabel, resolvedTarget, resolvedIcon } = useShellNavigationLink(props);
11
11
  </script>
12
12
 
13
13
  <template>
14
- <ShellNavigationTooltip v-if="resolvedTarget.href" :label="props.label">
14
+ <ShellNavigationTooltip v-if="resolvedTarget.href" :label="resolvedLabel">
15
15
  <template #default="{ activatorProps }">
16
16
  <v-list-item
17
17
  v-bind="activatorProps"
18
18
  class="shell-menu-link-item"
19
- :title="props.label"
19
+ :title="resolvedLabel"
20
20
  :to="resolvedTarget.sameOrigin ? resolvedTarget.href : undefined"
21
21
  :href="resolvedTarget.sameOrigin ? undefined : resolvedTarget.href"
22
22
  :prepend-icon="resolvedIcon || undefined"
23
23
  :disabled="props.disabled"
24
24
  :exact="props.exact"
25
- :aria-label="props.label"
25
+ :aria-label="resolvedLabel"
26
26
  @keydown.space="activateShellNavigationLinkOnSpace"
27
27
  />
28
28
  </template>
@@ -3,9 +3,11 @@ import {
3
3
  shellNavigationLinkProps,
4
4
  useShellNavigationLink
5
5
  } from "../composables/useShellNavigationLink.js";
6
+ import { useJskitText } from "../i18n.js";
6
7
 
7
8
  const props = defineProps(shellNavigationLinkProps);
8
- const { resolvedTarget, resolvedIcon } = useShellNavigationLink(props);
9
+ const { t } = useJskitText();
10
+ const { resolvedLabel, resolvedTarget, resolvedIcon } = useShellNavigationLink(props);
9
11
  </script>
10
12
 
11
13
  <template>
@@ -20,7 +22,7 @@ const { resolvedTarget, resolvedIcon } = useShellNavigationLink(props);
20
22
  stacked
21
23
  >
22
24
  <v-icon v-if="resolvedIcon" :icon="resolvedIcon" />
23
- <span class="tab-link-item__label">{{ props.label || "Tab" }}</span>
25
+ <span class="tab-link-item__label">{{ resolvedLabel || t("jskit.shell.layout.tab") }}</span>
24
26
  </v-btn>
25
27
  </template>
26
28
 
@@ -9,11 +9,14 @@ import {
9
9
  resolveSurfaceDefinitionFromPlacementContext,
10
10
  resolveSurfaceIdFromPlacementPathname
11
11
  } from "../placement/surfaceContext.js";
12
+ import { useJskitText } from "../i18n.js";
13
+
14
+ const { t, text } = useJskitText();
12
15
 
13
16
  function toSurfaceLabel(surfaceId = "") {
14
17
  const normalizedSurfaceId = String(surfaceId || "").trim().toLowerCase();
15
18
  if (!normalizedSurfaceId) {
16
- return "Surface";
19
+ return t("jskit.shell.layout.surface");
17
20
  }
18
21
 
19
22
  return normalizedSurfaceId
@@ -68,7 +71,8 @@ function useShellLayoutState(props = {}) {
68
71
  });
69
72
 
70
73
  const resolvedSurfaceLabel = computed(() => {
71
- const explicitLabel = String(props?.surfaceLabel || "").trim();
74
+ // A surface label may be a message key; plain text shows as written.
75
+ const explicitLabel = String(text(props?.surfaceLabel) || "").trim();
72
76
  if (explicitLabel) {
73
77
  return explicitLabel;
74
78
  }
@@ -77,7 +81,7 @@ function useShellLayoutState(props = {}) {
77
81
  placementContext?.value || null,
78
82
  resolvedSurface.value
79
83
  );
80
- const configuredLabel = String(surfaceDefinition?.label || "").trim();
84
+ const configuredLabel = String(text(surfaceDefinition?.label) || "").trim();
81
85
  if (configuredLabel) {
82
86
  return configuredLabel;
83
87
  }