@antelopejs/dms-lang 0.3.1 → 0.4.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/README.md +3 -3
- package/dist/frontend-module.d.ts +2 -0
- package/dist/frontend-module.js +19 -0
- package/dist/frontend-module.js.map +1 -0
- package/dist/index.js +2 -10
- package/dist/index.js.map +1 -1
- package/dist/pages/workspace.js +10 -1
- package/dist/pages/workspace.js.map +1 -1
- package/dist/utils/catalog.d.ts +1 -0
- package/dist/utils/catalog.js +6 -2
- package/dist/utils/catalog.js.map +1 -1
- package/dist/utils/registry.js +5 -8
- package/dist/utils/registry.js.map +1 -1
- package/frontend-vue/app/build/components/KeyAddModal.vue +2 -1
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +289 -348
- package/frontend-vue/app/build/components/KeyStatus.vue +45 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +2 -1
- package/frontend-vue/app/build/composables/useKeyPanel.ts +104 -46
- package/frontend-vue/app/components/TranslationQueue.vue +2 -2
- package/frontend-vue/app/components/WorkspaceList.vue +3 -8
- package/frontend-vue/app/components/WorkspaceScope.vue +2 -4
- package/frontend-vue/app/composables/translation/useKeyActions.ts +3 -1
- package/frontend-vue/app/composables/translation/useWorkspaceLabel.ts +28 -0
- package/frontend-vue/app/types/lang.ts +21 -0
- package/frontend-vue/i18n/locales/lang-en-GB.json +6 -9
- package/frontend-vue/i18n/locales/lang-fr-FR.json +8 -11
- package/frontend-vue/package.json +3 -3
- package/package.json +7 -6
- package/skills/dms-lang/SKILL.md +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import PlaceholderText from './PlaceholderText.vue'
|
|
3
|
+
|
|
4
|
+
// Under the key in the DMS row header of the key panel: what the key
|
|
5
|
+
// misses, its issues and its base text's placeholders.
|
|
6
|
+
interface Props {
|
|
7
|
+
missingCount: number
|
|
8
|
+
issueCount: number
|
|
9
|
+
/** `{price} {count}`; empty without any. */
|
|
10
|
+
placeholders: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
defineProps<Props>()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div
|
|
18
|
+
v-if="missingCount || issueCount || placeholders"
|
|
19
|
+
class="flex flex-wrap items-center gap-1.5"
|
|
20
|
+
>
|
|
21
|
+
<DmsStatusPill
|
|
22
|
+
v-if="missingCount"
|
|
23
|
+
dot="none"
|
|
24
|
+
tone="warning"
|
|
25
|
+
size="sm"
|
|
26
|
+
:label="$t('dms_lang.drawer.missing', missingCount)"
|
|
27
|
+
/>
|
|
28
|
+
<DmsStatusPill
|
|
29
|
+
v-if="issueCount"
|
|
30
|
+
dot="none"
|
|
31
|
+
tone="error"
|
|
32
|
+
size="sm"
|
|
33
|
+
icon="i-ph-warning"
|
|
34
|
+
:label="$t('dms_lang.drawer.issues', issueCount)"
|
|
35
|
+
/>
|
|
36
|
+
<span
|
|
37
|
+
v-if="placeholders"
|
|
38
|
+
class="text-dimmed inline-flex items-center gap-1.5 text-xs"
|
|
39
|
+
>
|
|
40
|
+
<UIcon name="i-ph-brackets-curly" class="size-3.5" />
|
|
41
|
+
{{ $t('dms_lang.drawer.placeholders') }}
|
|
42
|
+
<PlaceholderText :text="placeholders" />
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -23,6 +23,7 @@ const { addLocale, workspaces } = useI18nWorkspaces()
|
|
|
23
23
|
const { reportFailure } = useMutationToast()
|
|
24
24
|
const { findLanguages, fullName } = useLocaleNames()
|
|
25
25
|
const { refresh } = useWorkspaceFlat()
|
|
26
|
+
const { label: workspaceLabel } = useWorkspaceLabel()
|
|
26
27
|
|
|
27
28
|
const isOpen = ref(true)
|
|
28
29
|
const search = ref('')
|
|
@@ -110,7 +111,7 @@ function close(added: boolean) {
|
|
|
110
111
|
<template>
|
|
111
112
|
<UModal
|
|
112
113
|
v-model:open="isOpen"
|
|
113
|
-
:title="$t('dms_lang.language_add.title', { workspace:
|
|
114
|
+
:title="$t('dms_lang.language_add.title', { workspace: workspaceLabel })"
|
|
114
115
|
:description="
|
|
115
116
|
$t('dms_lang.language_add.description', { base: props.baseName })
|
|
116
117
|
"
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
2
|
import { useDmsRouter, useDmsState } from '#dms/frontend-module'
|
|
3
|
-
import type {
|
|
3
|
+
import type { DrawerRowHeader } from '#dms-ui/app/composables/containers/types'
|
|
4
|
+
import type { FlatTranslationRow, KeyPanelHeader } from '../../types/lang'
|
|
4
5
|
import KeyEditorDrawer from '../components/KeyEditorDrawer.vue'
|
|
6
|
+
import KeyStatus from '../components/KeyStatus.vue'
|
|
7
|
+
import { NAMESPACE_SEPARATOR } from '../../utils/translations'
|
|
5
8
|
import type { CellHold } from './useCellSaves'
|
|
6
9
|
|
|
7
10
|
export interface PanelRequest {
|
|
@@ -29,7 +32,8 @@ export interface PanelOptions {
|
|
|
29
32
|
onUnknown?: (key: string) => void
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
type DrawerOverlay = ReturnType<ReturnType<typeof
|
|
35
|
+
type DrawerOverlay = ReturnType<ReturnType<typeof useDrawer>['open']>
|
|
36
|
+
type PanelProps = Record<string, unknown>
|
|
33
37
|
|
|
34
38
|
interface PendingSwitch {
|
|
35
39
|
key: string
|
|
@@ -39,14 +43,15 @@ interface PendingSwitch {
|
|
|
39
43
|
interface PanelState {
|
|
40
44
|
shownWorkspace: string
|
|
41
45
|
drawer: DrawerOverlay | null
|
|
42
|
-
|
|
46
|
+
/** The props the open panel's body was last given. */
|
|
47
|
+
props: PanelProps
|
|
43
48
|
pendingSwitch: PendingSwitch | null
|
|
44
49
|
isDisposed: boolean
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
interface PanelContext {
|
|
48
53
|
options: PanelOptions
|
|
49
|
-
|
|
54
|
+
drawers: ReturnType<typeof useDrawer>
|
|
50
55
|
router: ReturnType<typeof useDmsRouter>
|
|
51
56
|
route: ReturnType<typeof useWorkspaceRoute>['route']
|
|
52
57
|
seeds: Ref<Record<string, FlatTranslationRow>>
|
|
@@ -56,6 +61,56 @@ interface PanelContext {
|
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
const KEY_QUERY = 'key'
|
|
64
|
+
const DRAWER_DIRECTION = 'right'
|
|
65
|
+
// Every key opens the same drawer, under one id: the DMS keeps the width the
|
|
66
|
+
// user drags it to under its `sizeKey`, on this device. One panel is open at
|
|
67
|
+
// a time, so the id stays unique.
|
|
68
|
+
const DRAWER_ID = 'dms-lang-key-panel'
|
|
69
|
+
const POSITION_LABEL = '$dms_lang.drawer.position'
|
|
70
|
+
|
|
71
|
+
// The key keeps its look in the DMS row header: in mono, wrapped only after
|
|
72
|
+
// its separators, the namespaces above it after its place among the keys,
|
|
73
|
+
// what it misses, its issues and its placeholders under them.
|
|
74
|
+
const KEY_LOOK = {
|
|
75
|
+
titleClass: 'font-mono',
|
|
76
|
+
titleBreakAfter: NAMESPACE_SEPARATOR,
|
|
77
|
+
subtitleClass: 'font-mono',
|
|
78
|
+
} as const
|
|
79
|
+
|
|
80
|
+
/** The DMS row header of a key just opened, before its body hands it over. */
|
|
81
|
+
function openingRowHeader(key: string): DrawerRowHeader {
|
|
82
|
+
return { title: key, ...KEY_LOOK }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The DMS row header for the key the body shows: the key, its place among
|
|
87
|
+
* the matrix's keys, previous / next and J / K, its namespaces and status.
|
|
88
|
+
* A key opened off the list has no place in it, so no steps.
|
|
89
|
+
*/
|
|
90
|
+
function rowHeaderOf(header: KeyPanelHeader): DrawerRowHeader {
|
|
91
|
+
return {
|
|
92
|
+
title: header.key,
|
|
93
|
+
...KEY_LOOK,
|
|
94
|
+
subtitle: header.crumbs || undefined,
|
|
95
|
+
component: KeyStatus,
|
|
96
|
+
componentOptions: {
|
|
97
|
+
missingCount: header.missingCount,
|
|
98
|
+
issueCount: header.issueCount,
|
|
99
|
+
placeholders: header.placeholders,
|
|
100
|
+
},
|
|
101
|
+
...(header.index >= 0 && {
|
|
102
|
+
positionLabel: POSITION_LABEL,
|
|
103
|
+
navigation: {
|
|
104
|
+
index: header.index,
|
|
105
|
+
total: header.total,
|
|
106
|
+
hasPrev: header.hasPrevious,
|
|
107
|
+
hasNext: header.hasNext,
|
|
108
|
+
prev: header.previous,
|
|
109
|
+
next: header.next,
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
}
|
|
113
|
+
}
|
|
59
114
|
|
|
60
115
|
function linkWithKey(context: PanelContext, key: string | undefined): string {
|
|
61
116
|
const { route } = context
|
|
@@ -78,7 +133,7 @@ function dropSeed(context: PanelContext, key: string) {
|
|
|
78
133
|
if (dropped) context.seeds.value = rest
|
|
79
134
|
}
|
|
80
135
|
|
|
81
|
-
function propsFor(context: PanelContext, request: PanelRequest) {
|
|
136
|
+
function propsFor(context: PanelContext, request: PanelRequest): PanelProps {
|
|
82
137
|
const { options } = context
|
|
83
138
|
const keys = options.keys()
|
|
84
139
|
const index = keys.indexOf(request.key)
|
|
@@ -95,9 +150,23 @@ function propsFor(context: PanelContext, request: PanelRequest) {
|
|
|
95
150
|
onNavigate: (key: string) => onNavigate(context, key),
|
|
96
151
|
onOverride: options.onOverride,
|
|
97
152
|
onKeep: options.onKeep,
|
|
153
|
+
onHeader: (header: KeyPanelHeader) =>
|
|
154
|
+
context.state.drawer?.patch({ rowHeader: rowHeaderOf(header) }),
|
|
98
155
|
}
|
|
99
156
|
}
|
|
100
157
|
|
|
158
|
+
/** Changes some of the open panel's props, keeping the others. */
|
|
159
|
+
function patchPanel(context: PanelContext, props: PanelProps) {
|
|
160
|
+
const { state } = context
|
|
161
|
+
state.props = { ...state.props, ...props }
|
|
162
|
+
state.drawer?.patch({ componentOptions: state.props })
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Asks the open panel to save what it can and close (see its `open`). */
|
|
166
|
+
function closePanel(context: PanelContext) {
|
|
167
|
+
patchPanel(context, { open: false })
|
|
168
|
+
}
|
|
169
|
+
|
|
101
170
|
function settleSwitch(context: PanelContext, shown: string | null) {
|
|
102
171
|
const pending = context.state.pendingSwitch
|
|
103
172
|
context.state.pendingSwitch = null
|
|
@@ -106,12 +175,11 @@ function settleSwitch(context: PanelContext, shown: string | null) {
|
|
|
106
175
|
|
|
107
176
|
function switchKey(
|
|
108
177
|
context: PanelContext,
|
|
109
|
-
drawer: DrawerOverlay,
|
|
110
178
|
request: PanelRequest,
|
|
111
179
|
): Promise<boolean> {
|
|
112
180
|
return new Promise((settle) => {
|
|
113
181
|
context.state.pendingSwitch = { key: request.key, settle }
|
|
114
|
-
|
|
182
|
+
patchPanel(context, propsFor(context, request))
|
|
115
183
|
})
|
|
116
184
|
}
|
|
117
185
|
|
|
@@ -120,17 +188,24 @@ function show(context: PanelContext, request: PanelRequest): Promise<boolean> {
|
|
|
120
188
|
state.shownWorkspace = context.workspace.value
|
|
121
189
|
settleSwitch(context, null)
|
|
122
190
|
if (state.drawer && request.key === context.shownKey.value) {
|
|
123
|
-
|
|
191
|
+
patchPanel(context, propsFor(context, request))
|
|
124
192
|
return Promise.resolve(true)
|
|
125
193
|
}
|
|
126
|
-
if (state.drawer) return switchKey(context,
|
|
194
|
+
if (state.drawer) return switchKey(context, request)
|
|
127
195
|
context.shownKey.value = request.key
|
|
128
|
-
state.
|
|
129
|
-
|
|
196
|
+
state.props = propsFor(context, request)
|
|
197
|
+
// The DMS row header names the key; the body hands over its place among
|
|
198
|
+
// the keys as it shows one (`onHeader`).
|
|
199
|
+
state.drawer = context.drawers.open({
|
|
200
|
+
direction: DRAWER_DIRECTION,
|
|
201
|
+
containerId: DRAWER_ID,
|
|
202
|
+
sizeKey: DRAWER_ID,
|
|
203
|
+
title: request.key,
|
|
204
|
+
rowHeader: openingRowHeader(request.key),
|
|
205
|
+
component: KeyEditorDrawer,
|
|
206
|
+
componentOptions: state.props,
|
|
130
207
|
})
|
|
131
|
-
void state.drawer
|
|
132
|
-
.open(propsFor(context, request))
|
|
133
|
-
.then(() => onClosed(context))
|
|
208
|
+
void state.drawer.result.then(() => onClosed(context))
|
|
134
209
|
return Promise.resolve(true)
|
|
135
210
|
}
|
|
136
211
|
|
|
@@ -141,50 +216,30 @@ async function open(
|
|
|
141
216
|
if (context.state.drawer) return show(context, request)
|
|
142
217
|
void show(context, request)
|
|
143
218
|
if (context.route.query[KEY_QUERY] === request.key) return true
|
|
144
|
-
context.state.pushedFrom = linkWithKey(context, undefined)
|
|
145
219
|
await context.router.push(linkWithKey(context, request.key))
|
|
146
220
|
return true
|
|
147
221
|
}
|
|
148
222
|
|
|
149
223
|
function onNavigate(context: PanelContext, key: string) {
|
|
150
224
|
context.shownKey.value = key
|
|
225
|
+
context.state.drawer?.patch({ title: key })
|
|
151
226
|
settleSwitch(context, key)
|
|
152
227
|
if (context.route.query[KEY_QUERY] !== key)
|
|
153
228
|
void context.router.replace(linkWithKey(context, key))
|
|
154
229
|
}
|
|
155
230
|
|
|
156
|
-
function nextRoute(context: PanelContext): Promise<void> {
|
|
157
|
-
return new Promise((resolve) => {
|
|
158
|
-
const stop = watch(
|
|
159
|
-
() => context.route.fullPath,
|
|
160
|
-
() => {
|
|
161
|
-
stop()
|
|
162
|
-
resolve()
|
|
163
|
-
},
|
|
164
|
-
)
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
async function leaveKeyEntry(context: PanelContext, from: string | null) {
|
|
169
|
-
const without = linkWithKey(context, undefined)
|
|
170
|
-
if (from === null) return context.router.replace(without)
|
|
171
|
-
const isBack = nextRoute(context)
|
|
172
|
-
context.router.back()
|
|
173
|
-
await isBack
|
|
174
|
-
if (linkWithKey(context, undefined) !== without)
|
|
175
|
-
await context.router.replace(without)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
231
|
function onClosed(context: PanelContext) {
|
|
179
232
|
const { state, route } = context
|
|
180
233
|
state.drawer = null
|
|
234
|
+
state.props = {}
|
|
181
235
|
settleSwitch(context, null)
|
|
182
236
|
if (!state.isDisposed) dropSeed(context, context.shownKey.value)
|
|
183
237
|
context.shownKey.value = ''
|
|
184
|
-
const from = state.pushedFrom
|
|
185
|
-
state.pushedFrom = null
|
|
186
238
|
if (state.isDisposed || !route.query[KEY_QUERY]) return
|
|
187
|
-
|
|
239
|
+
// Replaced, not left by going Back: a history step back renders the page
|
|
240
|
+
// anew (Inertia restores it from the history), which would fold the
|
|
241
|
+
// matrix's groups and lose its scroll.
|
|
242
|
+
void context.router.replace(linkWithKey(context, undefined))
|
|
188
243
|
}
|
|
189
244
|
|
|
190
245
|
function isOpenable(context: PanelContext, key: string): boolean {
|
|
@@ -195,7 +250,7 @@ function isOpenable(context: PanelContext, key: string): boolean {
|
|
|
195
250
|
}
|
|
196
251
|
|
|
197
252
|
function followQuery(context: PanelContext, key: string) {
|
|
198
|
-
if (!key) return context
|
|
253
|
+
if (!key) return closePanel(context)
|
|
199
254
|
if (key === context.shownKey.value || !isOpenable(context, key)) return
|
|
200
255
|
void show(context, { key })
|
|
201
256
|
}
|
|
@@ -204,13 +259,14 @@ function followWorkspace(context: PanelContext, workspace: string) {
|
|
|
204
259
|
const { drawer, shownWorkspace } = context.state
|
|
205
260
|
const shownKey = context.shownKey.value
|
|
206
261
|
if (!drawer || !shownKey || shownWorkspace === workspace) return
|
|
207
|
-
if (!isOpenable(context, shownKey)) return
|
|
262
|
+
if (!isOpenable(context, shownKey)) return closePanel(context)
|
|
208
263
|
void show(context, { key: shownKey })
|
|
209
264
|
}
|
|
210
265
|
|
|
211
266
|
function patchRights(context: PanelContext) {
|
|
212
267
|
const { options } = context
|
|
213
|
-
context.state.drawer
|
|
268
|
+
if (!context.state.drawer) return
|
|
269
|
+
patchPanel(context, {
|
|
214
270
|
editable: options.editable(),
|
|
215
271
|
manageKeys: options.manageKeys(),
|
|
216
272
|
canOverride: options.canOverride(),
|
|
@@ -247,6 +303,8 @@ function watchPanel(context: PanelContext) {
|
|
|
247
303
|
* The key panel of the matrix: one panel at a time (opening another key
|
|
248
304
|
* moves the open panel to it), and the key it shows in the URL (`?key=`), so
|
|
249
305
|
* a link or a refresh opens it again and the browser's Back button closes it.
|
|
306
|
+
* J and K step to the next and previous key while it is open (the DMS row
|
|
307
|
+
* header's).
|
|
250
308
|
* The open panel may refuse another key (one of its fields waits for a
|
|
251
309
|
* choice): `open` tells whether it took the key, so nothing handed over is
|
|
252
310
|
* dropped before it did.
|
|
@@ -254,7 +312,7 @@ function watchPanel(context: PanelContext) {
|
|
|
254
312
|
export function useKeyPanel(options: PanelOptions) {
|
|
255
313
|
const context: PanelContext = {
|
|
256
314
|
options,
|
|
257
|
-
|
|
315
|
+
drawers: useDrawer(),
|
|
258
316
|
router: useDmsRouter(),
|
|
259
317
|
route: useWorkspaceRoute().route,
|
|
260
318
|
seeds: useDmsState<Record<string, FlatTranslationRow>>(
|
|
@@ -266,7 +324,7 @@ export function useKeyPanel(options: PanelOptions) {
|
|
|
266
324
|
state: {
|
|
267
325
|
shownWorkspace: '',
|
|
268
326
|
drawer: null,
|
|
269
|
-
|
|
327
|
+
props: {},
|
|
270
328
|
pendingSwitch: null,
|
|
271
329
|
isDisposed: false,
|
|
272
330
|
},
|
|
@@ -274,7 +332,7 @@ export function useKeyPanel(options: PanelOptions) {
|
|
|
274
332
|
watchPanel(context)
|
|
275
333
|
onBeforeUnmount(() => {
|
|
276
334
|
context.state.isDisposed = true
|
|
277
|
-
context
|
|
335
|
+
closePanel(context)
|
|
278
336
|
})
|
|
279
337
|
return {
|
|
280
338
|
open: (request: PanelRequest) => open(context, request),
|
|
@@ -23,10 +23,10 @@ const LANGUAGE_SUGGESTIONS = 6
|
|
|
23
23
|
defineOptions({ inheritAttrs: false })
|
|
24
24
|
|
|
25
25
|
const { t } = useI18n()
|
|
26
|
-
const { selectedWorkspace } = useI18nWorkspaces()
|
|
27
26
|
const { flat, isLoaded } = useWorkspaceFlat()
|
|
28
27
|
useWorkspaceFlatSync()
|
|
29
28
|
const { canManage, isUnknown, isResolved, allows } = useWorkspaceContext()
|
|
29
|
+
const { label } = useWorkspaceLabel()
|
|
30
30
|
const { nameAmong } = useLocaleNames()
|
|
31
31
|
const { removeLanguage, makeBase } = useLanguageActions()
|
|
32
32
|
const links = useLangLinks()
|
|
@@ -172,7 +172,7 @@ onBeforeUnmount(() => clearTimeout(urlTimer))
|
|
|
172
172
|
"
|
|
173
173
|
:description="
|
|
174
174
|
$t('dms_lang.queue.unknown_description', {
|
|
175
|
-
workspace:
|
|
175
|
+
workspace: label,
|
|
176
176
|
})
|
|
177
177
|
"
|
|
178
178
|
:actions="unknownActions"
|
|
@@ -48,6 +48,7 @@ const { createWorkspace, importWorkspace } = useWorkspaceActions()
|
|
|
48
48
|
const { typeIcon, typeLabel, kindIcon } = useWorkspaceTypes()
|
|
49
49
|
const { pageAction, clearPageAction, selectWorkspace } = useWorkspaceRoute()
|
|
50
50
|
const { allows } = useWorkspaceContext()
|
|
51
|
+
const { labelOf } = useWorkspaceLabel()
|
|
51
52
|
const links = useLangLinks()
|
|
52
53
|
const { getPreference, setPreference } = usePreferences()
|
|
53
54
|
|
|
@@ -154,9 +155,7 @@ function kindPill(workspace: WorkspaceStats): WorkspacePill {
|
|
|
154
155
|
function labelsOf(workspace: WorkspaceStats): string[] {
|
|
155
156
|
return [
|
|
156
157
|
kindPill(workspace).label,
|
|
157
|
-
|
|
158
|
-
name: workspace.id,
|
|
159
|
-
}),
|
|
158
|
+
labelOf(workspace),
|
|
160
159
|
]
|
|
161
160
|
}
|
|
162
161
|
|
|
@@ -307,11 +306,7 @@ watch(
|
|
|
307
306
|
<div class="min-w-0 flex-1">
|
|
308
307
|
<div class="flex flex-wrap items-center gap-2">
|
|
309
308
|
<h3 class="text-highlighted truncate text-base font-semibold">
|
|
310
|
-
{{
|
|
311
|
-
$t(`dms_lang.workspace_kinds.${workspace.kind}.label`, {
|
|
312
|
-
name: workspace.id,
|
|
313
|
-
})
|
|
314
|
-
}}
|
|
309
|
+
{{ labelOf(workspace) }}
|
|
315
310
|
</h3>
|
|
316
311
|
<DmsStatusPill
|
|
317
312
|
dot="none"
|
|
@@ -21,6 +21,7 @@ const {
|
|
|
21
21
|
isUnknown,
|
|
22
22
|
isResolved,
|
|
23
23
|
} = useWorkspaceContext()
|
|
24
|
+
const { labelOf } = useWorkspaceLabel()
|
|
24
25
|
useLangChanges()
|
|
25
26
|
const {
|
|
26
27
|
switchLink,
|
|
@@ -43,10 +44,7 @@ const { addLanguage } = useLanguageActions()
|
|
|
43
44
|
const { typeIcon, typeLabel, kindIcon } = useWorkspaceTypes()
|
|
44
45
|
|
|
45
46
|
function workspaceLabel(workspace: WorkspaceSummary | null): string {
|
|
46
|
-
|
|
47
|
-
return t(`dms_lang.workspace_kinds.${workspace.kind}.label`, {
|
|
48
|
-
name: workspace.id,
|
|
49
|
-
})
|
|
47
|
+
return workspace ? labelOf(workspace) : ''
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
function trailingIconOf(workspace: WorkspaceSummary): string | undefined {
|
|
@@ -11,6 +11,7 @@ interface KeyActionsContext {
|
|
|
11
11
|
workspaces: ReturnType<typeof useI18nWorkspaces>
|
|
12
12
|
translations: ReturnType<typeof useWorkspaceFlat>
|
|
13
13
|
isDefault: ReturnType<typeof useWorkspaceContext>['isDefault']
|
|
14
|
+
workspaceLabel: ReturnType<typeof useWorkspaceLabel>['label']
|
|
14
15
|
tryMutate: ReturnType<typeof useMutationToast>['tryMutate']
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -121,7 +122,7 @@ async function removeKeyTexts(
|
|
|
121
122
|
const count = filled.length
|
|
122
123
|
const params = {
|
|
123
124
|
path: removal.path,
|
|
124
|
-
workspace,
|
|
125
|
+
workspace: context.workspaceLabel.value,
|
|
125
126
|
count,
|
|
126
127
|
locales: filled.join(', '),
|
|
127
128
|
}
|
|
@@ -213,6 +214,7 @@ export const useKeyActions = () => {
|
|
|
213
214
|
workspaces: useI18nWorkspaces(),
|
|
214
215
|
translations: useWorkspaceFlat(),
|
|
215
216
|
isDefault: useWorkspaceContext().isDefault,
|
|
217
|
+
workspaceLabel: useWorkspaceLabel().label,
|
|
216
218
|
tryMutate: useMutationToast().tryMutate,
|
|
217
219
|
}
|
|
218
220
|
return {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WorkspaceSummary } from '../../types/lang'
|
|
2
|
+
|
|
3
|
+
/** What naming a workspace needs. */
|
|
4
|
+
type NamedWorkspace = Pick<WorkspaceSummary, 'id' | 'kind'>
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The name a sentence gives a workspace: the label of its kind ("Project
|
|
8
|
+
* files"), or its id for an added one. Never the bare id of the project or
|
|
9
|
+
* modules workspace, which reads as an untranslated word.
|
|
10
|
+
*/
|
|
11
|
+
export const useWorkspaceLabel = () => {
|
|
12
|
+
const { t } = useI18n()
|
|
13
|
+
const { selectedWorkspace } = useI18nWorkspaces()
|
|
14
|
+
const { current } = useWorkspaceContext()
|
|
15
|
+
|
|
16
|
+
function labelOf(workspace: NamedWorkspace): string {
|
|
17
|
+
return t(`dms_lang.workspace_kinds.${workspace.kind}.label`, {
|
|
18
|
+
name: workspace.id,
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The name of the selected workspace, its id until the list is in. */
|
|
23
|
+
const label = computed(() =>
|
|
24
|
+
current.value ? labelOf(current.value) : selectedWorkspace.value,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
return { label, labelOf }
|
|
28
|
+
}
|
|
@@ -128,3 +128,24 @@ export interface NamespaceMatrix {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export type TranslationFilter = 'all' | 'missing' | 'complete' | 'issues'
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The key open in the key panel's body and its place among the keys: the
|
|
134
|
+
* body hands it over as it changes, the DMS row header draws it.
|
|
135
|
+
*/
|
|
136
|
+
export interface KeyPanelHeader {
|
|
137
|
+
key: string
|
|
138
|
+
/** The namespaces above the key, `common › actions`; empty at the root. */
|
|
139
|
+
crumbs: string
|
|
140
|
+
missingCount: number
|
|
141
|
+
issueCount: number
|
|
142
|
+
/** The base text's placeholders, `{price} {count}`; empty without any. */
|
|
143
|
+
placeholders: string
|
|
144
|
+
/** The key's place among the keys the panel steps through, from 0; -1 off the list. */
|
|
145
|
+
index: number
|
|
146
|
+
total: number
|
|
147
|
+
hasPrevious: boolean
|
|
148
|
+
hasNext: boolean
|
|
149
|
+
previous: () => void
|
|
150
|
+
next: () => void
|
|
151
|
+
}
|
|
@@ -376,10 +376,7 @@
|
|
|
376
376
|
"outdated": "To review"
|
|
377
377
|
},
|
|
378
378
|
"drawer": {
|
|
379
|
-
"
|
|
380
|
-
"eyebrow": "Key · {path}",
|
|
381
|
-
"previous": "Previous key",
|
|
382
|
-
"next": "Next key",
|
|
379
|
+
"position": "{index} of {total}",
|
|
383
380
|
"missing": "{n} missing | {n} missing",
|
|
384
381
|
"issues": "{n} issue | {n} issues",
|
|
385
382
|
"placeholders": "Variables",
|
|
@@ -436,7 +433,7 @@
|
|
|
436
433
|
"no_issues_description": "Every translation is valid, keeps the variables of its base text and needs no review.",
|
|
437
434
|
"review_issues": "Review issues ({count})",
|
|
438
435
|
"unknown_title": "{code} is not a language of this workspace",
|
|
439
|
-
"unknown_description": "Pick one of the languages of {workspace}
|
|
436
|
+
"unknown_description": "Pick one of the languages of “{workspace}”.",
|
|
440
437
|
"unknown_pick": "Translate {name}",
|
|
441
438
|
"pick_title": "Choose a language to translate",
|
|
442
439
|
"base_title": "{name} is the base language",
|
|
@@ -504,7 +501,7 @@
|
|
|
504
501
|
"hint": "Pick a namespace to scope the queue to it."
|
|
505
502
|
},
|
|
506
503
|
"language_add": {
|
|
507
|
-
"title": "Add a language to {workspace}",
|
|
504
|
+
"title": "Add a language to “{workspace}”",
|
|
508
505
|
"description": "Creates an empty file. Every key starts as missing and shows the {base} text as reference.",
|
|
509
506
|
"search": "Search languages or type a code (pt-BR)",
|
|
510
507
|
"added": "Added",
|
|
@@ -525,7 +522,7 @@
|
|
|
525
522
|
"locked": "Project files and module languages follow the files on disk. Create a workspace to manage its languages here."
|
|
526
523
|
},
|
|
527
524
|
"language_remove": {
|
|
528
|
-
"title": "Remove {name} from {workspace}
|
|
525
|
+
"title": "Remove {name} from “{workspace}”?",
|
|
529
526
|
"description": "Apps requesting {url} get a 404.",
|
|
530
527
|
"file": "{file} is deleted",
|
|
531
528
|
"strings": "Translated strings lost",
|
|
@@ -604,7 +601,7 @@
|
|
|
604
601
|
},
|
|
605
602
|
"key_add": {
|
|
606
603
|
"title": "Add key",
|
|
607
|
-
"description": "Added to {workspace}
|
|
604
|
+
"description": "Added to “{workspace}”. Write the text in the languages you know now; the others show as missing.",
|
|
608
605
|
"path": "Key path",
|
|
609
606
|
"texts_required": "Write the text in at least one language to add the key.",
|
|
610
607
|
"path_help": "Dot-separated, such as checkout.coupon.invalid.",
|
|
@@ -635,7 +632,7 @@
|
|
|
635
632
|
},
|
|
636
633
|
"key_delete": {
|
|
637
634
|
"title": "Delete {path}?",
|
|
638
|
-
"description": "The key, which has no text yet, is removed from every file of {workspace}
|
|
635
|
+
"description": "The key, which has no text yet, is removed from every file of “{workspace}”. | The key and its translation ({locales}) are removed from every file of “{workspace}”. | The key and its {count} translations ({locales}) are removed from every file of “{workspace}”.",
|
|
639
636
|
"submit": "Delete key",
|
|
640
637
|
"done": "Key {path} deleted",
|
|
641
638
|
"restored": "Key {path} restored"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"corrupt_file": "Un fichier de traduction n'est pas un JSON valide : corrigez-le avant de modifier.",
|
|
60
60
|
"corrupt_manifest": "Le fichier de réglages de l'espace de travail n'est pas un JSON valide : corrigez-le avant de modifier.",
|
|
61
61
|
"not_configured": "Le dossier des espaces de travail n'est pas configuré.",
|
|
62
|
-
"invalid_backup": "Ce fichier n'est pas une sauvegarde
|
|
62
|
+
"invalid_backup": "Ce fichier n'est pas une sauvegarde d'espace.",
|
|
63
63
|
"newer_backup": "Cette sauvegarde a été enregistrée par une version plus récente du module Traductions : mettez le module à jour pour l'importer.",
|
|
64
64
|
"message_syntax": {
|
|
65
65
|
"expected_token": "Il manque un caractère là où le message en attend un.",
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"hint_added": "Publié à l'adresse {url}",
|
|
206
206
|
"server_read_only_title": "La modification est désactivée sur ce serveur",
|
|
207
207
|
"server_read_only_description": "Les valeurs s'affichent en lecture seule. Mettez editable: true dans la configuration du module dms-lang pour les modifier ici.",
|
|
208
|
-
"settings": "Paramètres de {name}",
|
|
208
|
+
"settings": "Paramètres de « {name} »",
|
|
209
209
|
"unknown_title": "Espace introuvable",
|
|
210
210
|
"unknown_description": "Il a peut-être été renommé ou supprimé. Aucun autre espace n'est affiché à sa place.",
|
|
211
211
|
"unknown_action": "Voir les espaces"
|
|
@@ -376,10 +376,7 @@
|
|
|
376
376
|
"outdated": "À revoir"
|
|
377
377
|
},
|
|
378
378
|
"drawer": {
|
|
379
|
-
"
|
|
380
|
-
"eyebrow": "Clé · {path}",
|
|
381
|
-
"previous": "Clé précédente",
|
|
382
|
-
"next": "Clé suivante",
|
|
379
|
+
"position": "{index} sur {total}",
|
|
383
380
|
"missing": "{n} manquante | {n} manquantes",
|
|
384
381
|
"issues": "{n} anomalie | {n} anomalies",
|
|
385
382
|
"placeholders": "Variables",
|
|
@@ -436,7 +433,7 @@
|
|
|
436
433
|
"no_issues_description": "Chaque traduction est valide, garde les variables de son texte de base et n'est pas à revoir.",
|
|
437
434
|
"review_issues": "Revoir les anomalies ({count})",
|
|
438
435
|
"unknown_title": "{code} n'est pas une langue de cet espace",
|
|
439
|
-
"unknown_description": "Choisissez une des langues de {workspace}
|
|
436
|
+
"unknown_description": "Choisissez une des langues de « {workspace} ».",
|
|
440
437
|
"unknown_pick": "Traduire en {name}",
|
|
441
438
|
"pick_title": "Choisissez une langue à traduire",
|
|
442
439
|
"base_title": "{name} est la langue de base",
|
|
@@ -504,7 +501,7 @@
|
|
|
504
501
|
"hint": "Choisissez un espace de noms pour y limiter la file."
|
|
505
502
|
},
|
|
506
503
|
"language_add": {
|
|
507
|
-
"title": "Ajouter une langue à {workspace}",
|
|
504
|
+
"title": "Ajouter une langue à « {workspace} »",
|
|
508
505
|
"description": "Crée un fichier vide. Chaque clé démarre comme manquante et affiche le texte en {base} comme référence.",
|
|
509
506
|
"search": "Rechercher une langue ou saisir un code (pt-BR)",
|
|
510
507
|
"added": "Ajoutée",
|
|
@@ -525,7 +522,7 @@
|
|
|
525
522
|
"locked": "Les langues des fichiers du projet et des modules suivent les fichiers sur le disque. Créez un espace pour gérer ses langues ici."
|
|
526
523
|
},
|
|
527
524
|
"language_remove": {
|
|
528
|
-
"title": "Retirer {name} de {workspace} ?",
|
|
525
|
+
"title": "Retirer {name} de « {workspace} » ?",
|
|
529
526
|
"description": "Les applications qui demandent {url} reçoivent une erreur 404.",
|
|
530
527
|
"file": "{file} est supprimé",
|
|
531
528
|
"strings": "Textes traduits perdus",
|
|
@@ -604,7 +601,7 @@
|
|
|
604
601
|
},
|
|
605
602
|
"key_add": {
|
|
606
603
|
"title": "Ajouter une clé",
|
|
607
|
-
"description": "Ajoutée à {workspace}
|
|
604
|
+
"description": "Ajoutée à « {workspace} ». Écrivez le texte dans les langues que vous connaissez ; les autres apparaîtront comme manquantes.",
|
|
608
605
|
"path": "Chemin de la clé",
|
|
609
606
|
"texts_required": "Écrivez le texte dans au moins une langue pour ajouter la clé.",
|
|
610
607
|
"path_help": "Séparé par des points, comme checkout.coupon.invalid.",
|
|
@@ -635,7 +632,7 @@
|
|
|
635
632
|
},
|
|
636
633
|
"key_delete": {
|
|
637
634
|
"title": "Supprimer {path} ?",
|
|
638
|
-
"description": "La clé, qui n'a encore aucun texte, est retirée de tous les fichiers de {workspace}
|
|
635
|
+
"description": "La clé, qui n'a encore aucun texte, est retirée de tous les fichiers de « {workspace} ». | La clé et sa traduction ({locales}) sont retirées de tous les fichiers de « {workspace} ». | La clé et ses {count} traductions ({locales}) sont retirées de tous les fichiers de « {workspace} ».",
|
|
639
636
|
"submit": "Supprimer la clé",
|
|
640
637
|
"done": "Clé {path} supprimée",
|
|
641
638
|
"restored": "Clé {path} restaurée"
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"packageManager": "pnpm@10.6.5",
|
|
9
9
|
"engines": {
|
|
10
|
-
"@antelopejs/dms-frontend": ">=0.
|
|
10
|
+
"@antelopejs/dms-frontend": ">=0.9.0 <0.10.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "ajs dms build",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"lint:fix": "eslint . --fix"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@antelopejs/core": "1.
|
|
22
|
-
"@antelopejs/dms-frontend": "0.
|
|
21
|
+
"@antelopejs/core": "1.17.1",
|
|
22
|
+
"@antelopejs/dms-frontend": "0.9.0",
|
|
23
23
|
"@eslint/js": "^9",
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^8",
|
|
25
25
|
"@typescript-eslint/parser": "^8",
|