@antelopejs/dms-lang 0.5.3 → 0.7.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/README.md +5 -5
- package/dist/routes/translations.d.ts +14 -13
- package/dist/routes/translations.js +31 -29
- package/dist/routes/translations.js.map +1 -1
- package/dist/utils/query.d.ts +2 -0
- package/dist/utils/query.js +7 -0
- package/dist/utils/query.js.map +1 -0
- package/frontend-vue/.prettierignore +1 -0
- package/frontend-vue/.prettierrc +2 -2
- package/frontend-vue/app/build/components/KeyAddModal.vue +13 -5
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +24 -26
- package/frontend-vue/app/build/components/KeyRenameModal.vue +7 -1
- package/frontend-vue/app/build/components/KeyStatus.vue +4 -1
- package/frontend-vue/app/build/components/LanguageAddModal.vue +24 -4
- package/frontend-vue/app/build/components/LanguagePicker.vue +30 -10
- package/frontend-vue/app/build/components/LocaleTile.vue +2 -1
- package/frontend-vue/app/build/components/PlaceholderText.vue +10 -3
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +10 -1
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +23 -7
- package/frontend-vue/app/build/components/form/FormFieldRow.vue +12 -3
- package/frontend-vue/app/build/components/form/FormRows.vue +10 -2
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +2 -1
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +81 -20
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +6 -3
- package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +1 -0
- package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +2 -2
- package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +2 -1
- package/frontend-vue/app/build/components/queue/QueueActions.vue +12 -2
- package/frontend-vue/app/build/components/queue/QueueDone.vue +3 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +63 -19
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +24 -5
- package/frontend-vue/app/build/components/queue/QueueUpNext.vue +1 -1
- package/frontend-vue/app/build/composables/useCellEditor.ts +12 -2
- package/frontend-vue/app/build/composables/useCellMoves.ts +1 -0
- package/frontend-vue/app/build/composables/useCellSaves.ts +1 -0
- package/frontend-vue/app/build/composables/useKeyPanel.ts +4 -0
- package/frontend-vue/app/build/composables/useKeySaves.ts +3 -0
- package/frontend-vue/app/build/composables/useMatrixColumns.ts +78 -0
- package/frontend-vue/app/build/composables/useMatrixExport.ts +1 -0
- package/frontend-vue/app/build/composables/useMatrixFilters.ts +6 -0
- package/frontend-vue/app/build/composables/useMatrixView.ts +4 -0
- package/frontend-vue/app/build/composables/useQueueOrphans.ts +2 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +4 -0
- package/frontend-vue/app/build/drawer/KeyLanguageField.vue +37 -19
- package/frontend-vue/app/build/drawer/fieldFocus.ts +24 -0
- package/frontend-vue/app/build/matrix/MatrixDoneBanner.vue +4 -1
- package/frontend-vue/app/build/matrix/MatrixLanguageHeader.vue +36 -36
- package/frontend-vue/app/build/matrix/MatrixNoRows.vue +48 -39
- package/frontend-vue/app/components/LanguageNamespaces.vue +39 -11
- package/frontend-vue/app/components/NamespaceCoverage.vue +35 -9
- package/frontend-vue/app/components/TranslationMatrix.vue +84 -63
- package/frontend-vue/app/components/TranslationQueue.vue +25 -9
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +6 -2
- package/frontend-vue/app/components/WorkspaceGeneral.vue +34 -9
- package/frontend-vue/app/components/WorkspaceList.vue +63 -30
- package/frontend-vue/app/components/WorkspaceScope.vue +64 -31
- package/frontend-vue/app/composables/translation/useFirstRun.ts +1 -0
- package/frontend-vue/app/composables/translation/useKeyActions.ts +10 -0
- package/frontend-vue/app/composables/translation/useLangLinks.ts +1 -0
- package/frontend-vue/app/composables/translation/useLanguageActions.ts +11 -2
- package/frontend-vue/app/composables/translation/useLanguageQueue.ts +10 -0
- package/frontend-vue/app/composables/translation/useQueueDrafts.ts +4 -0
- package/frontend-vue/app/composables/translation/useQueueSession.ts +6 -0
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +6 -0
- package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +1 -0
- package/frontend-vue/app/composables/translation/useWorkspaceFill.ts +4 -0
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +11 -4
- package/frontend-vue/app/composables/translation/useWorkspaceLabel.ts +2 -0
- package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +5 -0
- package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +8 -0
- package/frontend-vue/app/utils/keySaveErrors.ts +1 -0
- package/frontend-vue/app/utils/keySaves.ts +1 -0
- package/frontend-vue/app/utils/matrixExport.ts +1 -0
- package/frontend-vue/app/utils/translations.ts +3 -3
- package/frontend-vue/app/utils/workspaceBackup.ts +1 -0
- package/frontend-vue/build/backend-boundary.ts +7 -2
- package/frontend-vue/eslint.config.mjs +20 -45
- package/frontend-vue/package.json +8 -8
- package/package.json +16 -16
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { DEFAULT_WORKSPACE } from '../../../composables/translation/useI18nWorkspaces'
|
|
3
|
+
import { useWorkspaceContext } from '../../../composables/translation/useWorkspaceContext'
|
|
4
|
+
import { useWorkspaceFlat } from '../../../composables/translation/useWorkspaceFlat'
|
|
5
|
+
import { useWorkspaceRoute } from '../../../composables/translation/useWorkspaceRoute'
|
|
2
6
|
import type { FlatTranslationRow } from '../../../types/lang'
|
|
3
7
|
import type { MessageIssueKind } from '../../../utils/translations'
|
|
4
8
|
import {
|
|
@@ -115,7 +119,10 @@ defineExpose({
|
|
|
115
119
|
<template>
|
|
116
120
|
<div class="space-y-4 px-4 py-4">
|
|
117
121
|
<div class="flex items-center gap-2">
|
|
118
|
-
<UIcon
|
|
122
|
+
<UIcon
|
|
123
|
+
name="i-ph-key"
|
|
124
|
+
class="text-dimmed size-4"
|
|
125
|
+
/>
|
|
119
126
|
<span class="break-all font-mono text-xs">
|
|
120
127
|
<span class="text-dimmed">{{ keyParts.path }}</span>
|
|
121
128
|
<span class="text-primary font-semibold">{{ keyParts.leaf }}</span>
|
|
@@ -153,7 +160,11 @@ defineExpose({
|
|
|
153
160
|
|
|
154
161
|
<div class="space-y-1.5">
|
|
155
162
|
<div class="flex items-center gap-2 text-sm">
|
|
156
|
-
<LocaleTile
|
|
163
|
+
<LocaleTile
|
|
164
|
+
:code="baseLocale"
|
|
165
|
+
size="sm"
|
|
166
|
+
is-base
|
|
167
|
+
/>
|
|
157
168
|
<span class="text-highlighted font-medium">
|
|
158
169
|
{{ nameOf(baseLocale) }}
|
|
159
170
|
</span>
|
|
@@ -170,20 +181,32 @@ defineExpose({
|
|
|
170
181
|
:text="baseText"
|
|
171
182
|
class="text-highlighted"
|
|
172
183
|
/>
|
|
173
|
-
<span
|
|
184
|
+
<span
|
|
185
|
+
v-else
|
|
186
|
+
class="text-dimmed italic"
|
|
187
|
+
>
|
|
174
188
|
{{ $t('dms_lang.queue.no_base') }}
|
|
175
189
|
</span>
|
|
176
190
|
</div>
|
|
177
191
|
</div>
|
|
178
192
|
|
|
179
|
-
<div
|
|
180
|
-
|
|
193
|
+
<div
|
|
194
|
+
v-if="contextLocales.length"
|
|
195
|
+
class="space-y-1"
|
|
196
|
+
>
|
|
197
|
+
<DmsEyebrowLabel
|
|
198
|
+
:label="$t('dms_lang.queue.context')"
|
|
199
|
+
size="xs"
|
|
200
|
+
/>
|
|
181
201
|
<p
|
|
182
202
|
v-for="code in contextLocales"
|
|
183
203
|
:key="code"
|
|
184
204
|
class="text-muted flex items-start gap-2 text-sm"
|
|
185
205
|
>
|
|
186
|
-
<LocaleTile
|
|
206
|
+
<LocaleTile
|
|
207
|
+
:code="code"
|
|
208
|
+
size="sm"
|
|
209
|
+
/>
|
|
187
210
|
<span :dir="textDirection(code)">
|
|
188
211
|
{{ stringValue(props.row.values[code]) }}
|
|
189
212
|
</span>
|
|
@@ -192,7 +215,10 @@ defineExpose({
|
|
|
192
215
|
|
|
193
216
|
<div class="space-y-1.5">
|
|
194
217
|
<div class="flex items-center gap-2 text-sm">
|
|
195
|
-
<LocaleTile
|
|
218
|
+
<LocaleTile
|
|
219
|
+
:code="locale"
|
|
220
|
+
size="sm"
|
|
221
|
+
/>
|
|
196
222
|
<span class="text-highlighted font-medium">{{ languageName }}</span>
|
|
197
223
|
<span class="text-dimmed font-mono text-xs">{{ locale }}</span>
|
|
198
224
|
<span
|
|
@@ -212,7 +238,7 @@ defineExpose({
|
|
|
212
238
|
</span>
|
|
213
239
|
</div>
|
|
214
240
|
|
|
215
|
-
<
|
|
241
|
+
<DmsNoticeBanner
|
|
216
242
|
v-if="conflict !== undefined"
|
|
217
243
|
tone="warning"
|
|
218
244
|
icon="i-ph-warning"
|
|
@@ -239,9 +265,9 @@ defineExpose({
|
|
|
239
265
|
@click="save.overwrite"
|
|
240
266
|
/>
|
|
241
267
|
</template>
|
|
242
|
-
</
|
|
268
|
+
</DmsNoticeBanner>
|
|
243
269
|
|
|
244
|
-
<
|
|
270
|
+
<DmsNoticeBanner
|
|
245
271
|
v-if="isOutdated && canEditValues && !drafts.has(props.row.key)"
|
|
246
272
|
tone="warning"
|
|
247
273
|
size="sm"
|
|
@@ -259,9 +285,9 @@ defineExpose({
|
|
|
259
285
|
@click="save.markReviewed"
|
|
260
286
|
/>
|
|
261
287
|
</template>
|
|
262
|
-
</
|
|
288
|
+
</DmsNoticeBanner>
|
|
263
289
|
|
|
264
|
-
<
|
|
290
|
+
<DmsNoticeBanner
|
|
265
291
|
v-if="!canEditValues"
|
|
266
292
|
tone="info"
|
|
267
293
|
size="sm"
|
|
@@ -272,7 +298,10 @@ defineExpose({
|
|
|
272
298
|
: $t('dms_lang.queue.read_only')
|
|
273
299
|
"
|
|
274
300
|
>
|
|
275
|
-
<template
|
|
301
|
+
<template
|
|
302
|
+
v-if="isModules"
|
|
303
|
+
#actions
|
|
304
|
+
>
|
|
276
305
|
<UButton
|
|
277
306
|
:label="$t('dms_lang.queue.override')"
|
|
278
307
|
icon="i-ph-pencil-simple"
|
|
@@ -282,7 +311,7 @@ defineExpose({
|
|
|
282
311
|
:to="overrideLink"
|
|
283
312
|
/>
|
|
284
313
|
</template>
|
|
285
|
-
</
|
|
314
|
+
</DmsNoticeBanner>
|
|
286
315
|
|
|
287
316
|
<UTextarea
|
|
288
317
|
ref="textarea"
|
|
@@ -300,25 +329,37 @@ defineExpose({
|
|
|
300
329
|
:ui="{ base: 'text-base' }"
|
|
301
330
|
/>
|
|
302
331
|
|
|
303
|
-
<ul
|
|
332
|
+
<ul
|
|
333
|
+
v-if="issues.length"
|
|
334
|
+
class="space-y-0.5 text-xs"
|
|
335
|
+
>
|
|
304
336
|
<li
|
|
305
337
|
v-for="issue in issues"
|
|
306
338
|
:key="issue.kind"
|
|
307
339
|
class="inline-flex w-full items-center gap-1"
|
|
308
340
|
:class="issue.severity === 'error' ? 'text-error' : 'text-warning'"
|
|
309
341
|
>
|
|
310
|
-
<UIcon
|
|
342
|
+
<UIcon
|
|
343
|
+
name="i-ph-warning"
|
|
344
|
+
class="size-3.5 shrink-0"
|
|
345
|
+
/>
|
|
311
346
|
{{ messageIssueText(issue, t) }}
|
|
312
347
|
</li>
|
|
313
348
|
</ul>
|
|
314
349
|
|
|
315
|
-
<ul
|
|
350
|
+
<ul
|
|
351
|
+
v-if="rejectedProblems.length"
|
|
352
|
+
class="text-error space-y-0.5 text-xs"
|
|
353
|
+
>
|
|
316
354
|
<li
|
|
317
355
|
v-for="problem in rejectedProblems"
|
|
318
356
|
:key="problem"
|
|
319
357
|
class="inline-flex w-full items-center gap-1"
|
|
320
358
|
>
|
|
321
|
-
<UIcon
|
|
359
|
+
<UIcon
|
|
360
|
+
name="i-ph-x-circle"
|
|
361
|
+
class="size-3.5 shrink-0"
|
|
362
|
+
/>
|
|
322
363
|
{{ problem }}
|
|
323
364
|
</li>
|
|
324
365
|
</ul>
|
|
@@ -366,7 +407,10 @@ defineExpose({
|
|
|
366
407
|
/>
|
|
367
408
|
</div>
|
|
368
409
|
|
|
369
|
-
<p
|
|
410
|
+
<p
|
|
411
|
+
v-if="isArmed && !isBlocked"
|
|
412
|
+
class="text-warning text-xs font-medium"
|
|
413
|
+
>
|
|
370
414
|
{{ $t('dms_lang.queue.save_anyway_hint') }}
|
|
371
415
|
</p>
|
|
372
416
|
</div>
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useI18nWorkspaces } from '../../../composables/translation/useI18nWorkspaces'
|
|
3
|
+
import { useLangFormat } from '../../../composables/translation/useLangFormat'
|
|
4
|
+
import { useLangLinks } from '../../../composables/translation/useLangLinks'
|
|
5
|
+
import { useLocaleNames } from '../../../composables/translation/useLocaleNames'
|
|
6
|
+
import { useWorkspaceFlat } from '../../../composables/translation/useWorkspaceFlat'
|
|
7
|
+
import { useWorkspaceRoute } from '../../../composables/translation/useWorkspaceRoute'
|
|
2
8
|
import type { DropdownMenuItem } from '@nuxt/ui'
|
|
3
9
|
import { QUEUE_MODES } from '../../../composables/translation/useLanguageQueue'
|
|
4
10
|
import type { DraftGroup } from '../../../utils/queueDrafts'
|
|
@@ -93,9 +99,15 @@ const draftLinks = computed(() => drafts.elsewhere.value.map(draftLink))
|
|
|
93
99
|
<template>
|
|
94
100
|
<div class="border-default space-y-3 border-b px-4 py-3">
|
|
95
101
|
<div class="flex flex-wrap items-center gap-x-3 gap-y-2">
|
|
96
|
-
<LocaleTile
|
|
102
|
+
<LocaleTile
|
|
103
|
+
:code="locale"
|
|
104
|
+
:siblings="flat.locales"
|
|
105
|
+
/>
|
|
97
106
|
<div class="grid min-w-0 gap-px">
|
|
98
|
-
<
|
|
107
|
+
<DmsEyebrowLabel
|
|
108
|
+
:label="$t('dms_lang.queue.title')"
|
|
109
|
+
size="xs"
|
|
110
|
+
/>
|
|
99
111
|
<span class="text-highlighted truncate text-base font-semibold">
|
|
100
112
|
{{ languageName }}
|
|
101
113
|
<span class="text-dimmed font-mono text-xs font-normal">
|
|
@@ -124,7 +136,10 @@ const draftLinks = computed(() => drafts.elsewhere.value.map(draftLink))
|
|
|
124
136
|
v-if="draftLinks.length"
|
|
125
137
|
class="text-muted flex flex-wrap items-center gap-1.5 text-xs"
|
|
126
138
|
>
|
|
127
|
-
<UIcon
|
|
139
|
+
<UIcon
|
|
140
|
+
name="i-ph-note-pencil"
|
|
141
|
+
class="text-warning size-3.5"
|
|
142
|
+
/>
|
|
128
143
|
<span>{{ $t('dms_lang.queue.drafts_elsewhere') }}</span>
|
|
129
144
|
<UButton
|
|
130
145
|
v-for="entry in draftLinks"
|
|
@@ -137,7 +152,7 @@ const draftLinks = computed(() => drafts.elsewhere.value.map(draftLink))
|
|
|
137
152
|
/>
|
|
138
153
|
</div>
|
|
139
154
|
<div class="flex flex-wrap items-center gap-3">
|
|
140
|
-
<
|
|
155
|
+
<DmsMeterBar
|
|
141
156
|
class="min-w-24 flex-1"
|
|
142
157
|
:value="session.progress.value"
|
|
143
158
|
:max="100"
|
|
@@ -156,7 +171,11 @@ const draftLinks = computed(() => drafts.elsewhere.value.map(draftLink))
|
|
|
156
171
|
:aria-label="$t('dms_lang.queue.scope_clear', { namespace })"
|
|
157
172
|
@click="namespace = ''"
|
|
158
173
|
/>
|
|
159
|
-
<
|
|
174
|
+
<DmsSegmentedControl
|
|
175
|
+
v-model="mode"
|
|
176
|
+
:items="modeItems"
|
|
177
|
+
size="xs"
|
|
178
|
+
/>
|
|
160
179
|
</div>
|
|
161
180
|
</div>
|
|
162
181
|
</template>
|
|
@@ -16,7 +16,7 @@ const { upNext, drafts, baseLocale } = session
|
|
|
16
16
|
:key="entry.row.key"
|
|
17
17
|
class="grid grid-cols-[4rem_minmax(0,16rem)_minmax(0,1fr)] items-center gap-3 px-4 py-2"
|
|
18
18
|
>
|
|
19
|
-
<
|
|
19
|
+
<DmsEyebrowLabel
|
|
20
20
|
v-if="offset === 0"
|
|
21
21
|
:label="$t('dms_lang.queue.up_next')"
|
|
22
22
|
size="xs"
|
|
@@ -83,7 +83,12 @@ function trackDraft(
|
|
|
83
83
|
context.isDirty.value = text !== context.options.shownValue(key, code)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function open(
|
|
86
|
+
function open(
|
|
87
|
+
context: EditorContext,
|
|
88
|
+
key: string,
|
|
89
|
+
code: string,
|
|
90
|
+
draft: string,
|
|
91
|
+
) {
|
|
87
92
|
context.editing.value = { key, code, draft }
|
|
88
93
|
trackDraft(context, key, code, draft)
|
|
89
94
|
}
|
|
@@ -139,7 +144,12 @@ function startEdit(
|
|
|
139
144
|
options.saves.begin(address)
|
|
140
145
|
context.opened.workspace = options.workspace.value
|
|
141
146
|
context.opened.isBase = code === options.baseLocale()
|
|
142
|
-
open(
|
|
147
|
+
open(
|
|
148
|
+
context,
|
|
149
|
+
key,
|
|
150
|
+
code,
|
|
151
|
+
draft ?? failure?.draft ?? options.shownValue(key, code),
|
|
152
|
+
)
|
|
143
153
|
context.cursor.value = { key, code }
|
|
144
154
|
options.onStart(key)
|
|
145
155
|
}
|
|
@@ -3,6 +3,7 @@ import type { FlatTranslationRow } from '../../types/lang'
|
|
|
3
3
|
import type { CellMove, CellRef } from './useCellEditor'
|
|
4
4
|
import type { MatrixGroup } from './useMatrixFilters'
|
|
5
5
|
import type { useMatrixRows } from './useMatrixRows'
|
|
6
|
+
import { isRowValueMissing } from '../../utils/translations.ts'
|
|
6
7
|
|
|
7
8
|
/** Forward or backward through the cells. */
|
|
8
9
|
export type JumpStep = 1 | -1
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
type KeyWriteFailed,
|
|
18
18
|
type KeyWriteOutcome,
|
|
19
19
|
} from './useKeySaves'
|
|
20
|
+
import { useMutationToast } from '../../composables/translation/useMutationToast.ts'
|
|
20
21
|
|
|
21
22
|
export interface CellFailure {
|
|
22
23
|
/** The text that could not be saved: kept until saved or discarded. */
|
|
@@ -6,6 +6,10 @@ import KeyEditorDrawer from '../components/KeyEditorDrawer.vue'
|
|
|
6
6
|
import KeyStatus from '../components/KeyStatus.vue'
|
|
7
7
|
import { NAMESPACE_SEPARATOR } from '../../utils/translations'
|
|
8
8
|
import type { CellHold } from './useCellSaves'
|
|
9
|
+
import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
|
|
10
|
+
import { linkWithQuery } from '../../composables/translation/useLangLinks.ts'
|
|
11
|
+
import { useWorkspaceFlat } from '../../composables/translation/useWorkspaceFlat.ts'
|
|
12
|
+
import { useWorkspaceRoute } from '../../composables/translation/useWorkspaceRoute.ts'
|
|
9
13
|
|
|
10
14
|
export interface PanelRequest {
|
|
11
15
|
key: string
|
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
type SaveState,
|
|
17
17
|
type WriteLink,
|
|
18
18
|
} from '../../utils/keySaves'
|
|
19
|
+
import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
|
|
20
|
+
import { useMutationToast } from '../../composables/translation/useMutationToast.ts'
|
|
21
|
+
import { useWorkspaceFlat } from '../../composables/translation/useWorkspaceFlat.ts'
|
|
19
22
|
|
|
20
23
|
/** The key a write goes to. */
|
|
21
24
|
export interface KeyTarget {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { computed, type Ref } from 'vue'
|
|
2
|
+
import type { FlatTranslations, LanguageCoverage } from '../../types/lang'
|
|
3
|
+
import { languageCoverage } from '../../utils/coverage.ts'
|
|
4
|
+
import type { MatrixFilterState } from './useMatrixFilters'
|
|
5
|
+
|
|
6
|
+
const KEY_COLUMN_REM = 16
|
|
7
|
+
const LANGUAGE_COLUMN_REM = 15
|
|
8
|
+
const TODO_COLUMN_REM = 28
|
|
9
|
+
|
|
10
|
+
/** What the matrix columns are drawn from. */
|
|
11
|
+
export interface MatrixColumnSources {
|
|
12
|
+
flat: Ref<FlatTranslations>
|
|
13
|
+
filters: Ref<MatrixFilterState>
|
|
14
|
+
/** The saved order of the language columns. */
|
|
15
|
+
order: Readonly<Ref<string[]>>
|
|
16
|
+
isCompact: Readonly<Ref<boolean>>
|
|
17
|
+
/** The name of a language among the workspace's languages. */
|
|
18
|
+
nameAmong: (code: string, codes: string[]) => string
|
|
19
|
+
fullName: (code: string) => string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The language columns of the matrix: every language in the saved order, or
|
|
24
|
+
* the base next to the language being translated (the one chosen, or the
|
|
25
|
+
* first after the base on a compact screen).
|
|
26
|
+
*/
|
|
27
|
+
export function useMatrixColumns(sources: MatrixColumnSources) {
|
|
28
|
+
const { flat, filters, order, isCompact, nameAmong, fullName } = sources
|
|
29
|
+
const languages = computed<LanguageCoverage[]>(() =>
|
|
30
|
+
languageCoverage(flat.value, (code) => nameAmong(code, flat.value.locales)),
|
|
31
|
+
)
|
|
32
|
+
const languageByCode = computed(
|
|
33
|
+
() => new Map(languages.value.map((entry) => [entry.code, entry])),
|
|
34
|
+
)
|
|
35
|
+
const targetLanguages = computed(() =>
|
|
36
|
+
languages.value
|
|
37
|
+
.filter((entry) => !entry.isBase)
|
|
38
|
+
.map((entry) => ({ code: entry.code, name: fullName(entry.code) })),
|
|
39
|
+
)
|
|
40
|
+
const todoLanguage = computed(() => {
|
|
41
|
+
const chosen = filters.value.missingIn
|
|
42
|
+
if (chosen && flat.value.locales.includes(chosen)) return chosen
|
|
43
|
+
if (!isCompact.value) return ''
|
|
44
|
+
const base = flat.value.defaultLocale
|
|
45
|
+
return order.value.find((code) => code !== base) ?? ''
|
|
46
|
+
})
|
|
47
|
+
const columnCodes = computed(() => {
|
|
48
|
+
if (!todoLanguage.value) return order.value
|
|
49
|
+
const base = flat.value.defaultLocale
|
|
50
|
+
return [base, todoLanguage.value].filter((code) =>
|
|
51
|
+
flat.value.locales.includes(code),
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
const columns = computed(() =>
|
|
55
|
+
columnCodes.value
|
|
56
|
+
.map((code) => languageByCode.value.get(code))
|
|
57
|
+
.filter((entry): entry is LanguageCoverage => Boolean(entry)),
|
|
58
|
+
)
|
|
59
|
+
const columnSiblings = computed(() =>
|
|
60
|
+
columns.value.map((entry) => entry.code),
|
|
61
|
+
)
|
|
62
|
+
const compactColumn = computed(() => columns.value.at(-1))
|
|
63
|
+
const tableMinWidth = computed(() => {
|
|
64
|
+
const column = todoLanguage.value ? TODO_COLUMN_REM : LANGUAGE_COLUMN_REM
|
|
65
|
+
return `${KEY_COLUMN_REM + columns.value.length * column}rem`
|
|
66
|
+
})
|
|
67
|
+
return {
|
|
68
|
+
languages,
|
|
69
|
+
languageByCode,
|
|
70
|
+
targetLanguages,
|
|
71
|
+
todoLanguage,
|
|
72
|
+
columnCodes,
|
|
73
|
+
columns,
|
|
74
|
+
columnSiblings,
|
|
75
|
+
compactColumn,
|
|
76
|
+
tableMinWidth,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -3,6 +3,7 @@ import UButton from '@nuxt/ui/components/Button.vue'
|
|
|
3
3
|
import UDropdownMenu from '@nuxt/ui/components/DropdownMenu.vue'
|
|
4
4
|
import type { FlatTranslationRow, FlatTranslations } from '../../types/lang'
|
|
5
5
|
import { exportFileName, translationsCsv } from '../../utils/matrixExport'
|
|
6
|
+
import { downloadText } from '../../utils/download.ts'
|
|
6
7
|
|
|
7
8
|
interface MatrixExportOptions {
|
|
8
9
|
t: ReturnType<typeof useI18n>['t']
|
|
@@ -4,6 +4,12 @@ import type {
|
|
|
4
4
|
FlatTranslations,
|
|
5
5
|
TranslationFilter,
|
|
6
6
|
} from '../../types/lang'
|
|
7
|
+
import {
|
|
8
|
+
isRowValueMissing,
|
|
9
|
+
namespaceOf,
|
|
10
|
+
needsReview,
|
|
11
|
+
stringValue,
|
|
12
|
+
} from '../../utils/translations.ts'
|
|
7
13
|
|
|
8
14
|
export interface MatrixGroup {
|
|
9
15
|
namespace: string
|
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
parseFilter,
|
|
7
7
|
type MatrixFilterState,
|
|
8
8
|
} from './useMatrixFilters'
|
|
9
|
+
import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
|
|
10
|
+
import { linkWithQuery } from '../../composables/translation/useLangLinks.ts'
|
|
11
|
+
import { useWorkspaceFlat } from '../../composables/translation/useWorkspaceFlat.ts'
|
|
12
|
+
import { useWorkspaceRoute } from '../../composables/translation/useWorkspaceRoute.ts'
|
|
9
13
|
|
|
10
14
|
type FilterQuery = Record<keyof MatrixFilterState, string>
|
|
11
15
|
|
|
@@ -2,6 +2,8 @@ import type { FlatTranslations } from '../../types/lang'
|
|
|
2
2
|
import type { QueueSession } from '../../composables/translation/useQueueSession'
|
|
3
3
|
import type { DraftCheck, DraftId } from '../../utils/queueDrafts'
|
|
4
4
|
import { useQueueToasts } from './useQueueToasts'
|
|
5
|
+
import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
|
|
6
|
+
import { useWorkspaceFlat } from '../../composables/translation/useWorkspaceFlat.ts'
|
|
5
7
|
|
|
6
8
|
/** What is known to exist, for telling which drafts lost their key. */
|
|
7
9
|
interface LiveTargets {
|
|
@@ -7,6 +7,10 @@ import { DRAFT_SEPARATOR } from '../../utils/queueDrafts'
|
|
|
7
7
|
import type { QueueEditing } from './useQueueEditing'
|
|
8
8
|
import { useKeySaves, type KeyWriteFailed } from './useKeySaves'
|
|
9
9
|
import { useQueueToasts } from './useQueueToasts'
|
|
10
|
+
import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
|
|
11
|
+
import { normalizeDraft } from '../../composables/translation/useLanguageQueue.ts'
|
|
12
|
+
import { useMutationToast } from '../../composables/translation/useMutationToast.ts'
|
|
13
|
+
import { useWorkspaceContext } from '../../composables/translation/useWorkspaceContext.ts'
|
|
10
14
|
|
|
11
15
|
/** A text the server refused, with its problems. */
|
|
12
16
|
interface Rejection {
|
|
@@ -56,7 +56,11 @@ const props = defineProps<{
|
|
|
56
56
|
|
|
57
57
|
<template>
|
|
58
58
|
<div class="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
|
|
59
|
-
<LocaleTile
|
|
59
|
+
<LocaleTile
|
|
60
|
+
:code="code"
|
|
61
|
+
size="sm"
|
|
62
|
+
:is-base="code === base"
|
|
63
|
+
/>
|
|
60
64
|
<label
|
|
61
65
|
v-if="props.editable"
|
|
62
66
|
:for="fieldIdOf(code)"
|
|
@@ -64,7 +68,10 @@ const props = defineProps<{
|
|
|
64
68
|
>
|
|
65
69
|
{{ nativeName(code) }}
|
|
66
70
|
</label>
|
|
67
|
-
<span
|
|
71
|
+
<span
|
|
72
|
+
v-else
|
|
73
|
+
class="text-highlighted font-medium"
|
|
74
|
+
>
|
|
68
75
|
{{ nativeName(code) }}
|
|
69
76
|
</span>
|
|
70
77
|
<span class="text-dimmed font-mono text-xs">{{ code }}</span>
|
|
@@ -80,7 +87,10 @@ const props = defineProps<{
|
|
|
80
87
|
v-if="hasConflict(code)"
|
|
81
88
|
class="text-error inline-flex items-center gap-1 font-medium"
|
|
82
89
|
>
|
|
83
|
-
<UIcon
|
|
90
|
+
<UIcon
|
|
91
|
+
name="i-ph-warning"
|
|
92
|
+
class="size-3.5"
|
|
93
|
+
/>
|
|
84
94
|
{{ $t('dms_lang.drawer.conflict') }}
|
|
85
95
|
</span>
|
|
86
96
|
<template v-else-if="saveStateOf(code) !== 'idle'">
|
|
@@ -102,11 +112,7 @@ const props = defineProps<{
|
|
|
102
112
|
class="text-warning font-mono font-semibold uppercase"
|
|
103
113
|
>
|
|
104
114
|
{{
|
|
105
|
-
$t(
|
|
106
|
-
code === base
|
|
107
|
-
? BASE_MISSING_LABEL
|
|
108
|
-
: FIELD_STATUS_LABELS.missing,
|
|
109
|
-
)
|
|
115
|
+
$t(code === base ? BASE_MISSING_LABEL : FIELD_STATUS_LABELS.missing)
|
|
110
116
|
}}
|
|
111
117
|
</span>
|
|
112
118
|
<template v-else-if="statusOf(code) !== 'done'">
|
|
@@ -161,10 +167,18 @@ const props = defineProps<{
|
|
|
161
167
|
/>
|
|
162
168
|
<div
|
|
163
169
|
v-else
|
|
164
|
-
class="border-default
|
|
170
|
+
class="border-default bg-(--dms-bg-muted) rounded-md border px-3 py-2 text-sm"
|
|
165
171
|
>
|
|
166
|
-
<PlaceholderText
|
|
167
|
-
|
|
172
|
+
<PlaceholderText
|
|
173
|
+
v-if="draftOf(code)"
|
|
174
|
+
:text="draftOf(code)"
|
|
175
|
+
/>
|
|
176
|
+
<span
|
|
177
|
+
v-else
|
|
178
|
+
class="text-dimmed"
|
|
179
|
+
>
|
|
180
|
+
—
|
|
181
|
+
</span>
|
|
168
182
|
<p
|
|
169
183
|
v-if="row.overrides?.[code]"
|
|
170
184
|
class="text-dimmed border-default mt-2 border-t pt-2 text-xs"
|
|
@@ -183,13 +197,18 @@ const props = defineProps<{
|
|
|
183
197
|
<p class="text-dimmed">
|
|
184
198
|
<template v-if="ownOf(code)">
|
|
185
199
|
{{ $t('dms_lang.drawer.conflict_value') }}
|
|
186
|
-
<PlaceholderText
|
|
200
|
+
<PlaceholderText
|
|
201
|
+
:text="ownOf(code)"
|
|
202
|
+
class="text-default"
|
|
203
|
+
/>
|
|
187
204
|
</template>
|
|
188
205
|
<template v-else>
|
|
189
206
|
{{ $t('dms_lang.drawer.conflict_empty') }}
|
|
190
207
|
</template>
|
|
191
208
|
</p>
|
|
192
|
-
<p class="text-dimmed">
|
|
209
|
+
<p class="text-dimmed">
|
|
210
|
+
{{ $t('dms_lang.drawer.conflict_help') }}
|
|
211
|
+
</p>
|
|
193
212
|
<div class="flex flex-wrap gap-1.5">
|
|
194
213
|
<UButton
|
|
195
214
|
size="xs"
|
|
@@ -209,7 +228,10 @@ const props = defineProps<{
|
|
|
209
228
|
/>
|
|
210
229
|
</div>
|
|
211
230
|
</div>
|
|
212
|
-
<p
|
|
231
|
+
<p
|
|
232
|
+
v-else-if="fieldErrors[code]"
|
|
233
|
+
class="text-error text-xs"
|
|
234
|
+
>
|
|
213
235
|
{{ fieldErrors[code] }}
|
|
214
236
|
</p>
|
|
215
237
|
<div
|
|
@@ -221,11 +243,7 @@ const props = defineProps<{
|
|
|
221
243
|
:key="issue.kind"
|
|
222
244
|
class="flex flex-wrap items-center gap-x-3 gap-y-1"
|
|
223
245
|
>
|
|
224
|
-
<span
|
|
225
|
-
:class="
|
|
226
|
-
issue.severity === 'error' ? 'text-error' : 'text-warning'
|
|
227
|
-
"
|
|
228
|
-
>
|
|
246
|
+
<span :class="issue.severity === 'error' ? 'text-error' : 'text-warning'">
|
|
229
247
|
{{ messageIssueText(issue, t) }}
|
|
230
248
|
<template v-if="issue.kind === 'missing'">
|
|
231
249
|
{{
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { nextTick, type Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
/** Finds and focuses the text field of a language inside the key panel body. */
|
|
4
|
+
export function useFieldFocus(body: Readonly<Ref<HTMLElement | null>>) {
|
|
5
|
+
function fieldInput(code: string): HTMLTextAreaElement | null {
|
|
6
|
+
return (
|
|
7
|
+
body.value?.querySelector<HTMLTextAreaElement>(
|
|
8
|
+
`[data-locale="${code}"] textarea`,
|
|
9
|
+
) ?? null
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function focusField(code?: string, caret?: number) {
|
|
14
|
+
if (!code) return
|
|
15
|
+
await nextTick()
|
|
16
|
+
const input = fieldInput(code)
|
|
17
|
+
if (!input) return
|
|
18
|
+
input.scrollIntoView({ block: 'nearest' })
|
|
19
|
+
input.focus()
|
|
20
|
+
if (caret !== undefined) input.setSelectionRange(caret, caret)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return { fieldInput, focusField }
|
|
24
|
+
}
|
|
@@ -14,7 +14,10 @@ defineProps<{
|
|
|
14
14
|
class="border-default bg-success/5 flex flex-wrap items-center gap-2 border-b px-4 py-2 text-sm"
|
|
15
15
|
role="status"
|
|
16
16
|
>
|
|
17
|
-
<UIcon
|
|
17
|
+
<UIcon
|
|
18
|
+
name="i-ph-check-circle"
|
|
19
|
+
class="text-success size-4"
|
|
20
|
+
/>
|
|
18
21
|
<span class="text-default">
|
|
19
22
|
{{
|
|
20
23
|
$t(
|