@antelopejs/dms-lang 0.6.0 → 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/frontend-vue/.prettierignore +1 -0
- package/frontend-vue/.prettierrc +1 -3
- package/frontend-vue/app/build/components/KeyAddModal.vue +8 -4
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +16 -24
- package/frontend-vue/app/build/components/KeyRenameModal.vue +3 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +13 -5
- package/frontend-vue/app/build/components/LanguagePicker.vue +8 -5
- package/frontend-vue/app/build/components/LocaleTile.vue +2 -1
- package/frontend-vue/app/build/components/PlaceholderText.vue +1 -1
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +5 -0
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +8 -4
- package/frontend-vue/app/build/components/form/FormRows.vue +3 -1
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +2 -1
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +7 -3
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +2 -2
- 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 +1 -0
- package/frontend-vue/app/build/components/queue/QueueDone.vue +3 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +11 -7
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +9 -3
- 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 +11 -17
- package/frontend-vue/app/build/drawer/fieldFocus.ts +24 -0
- package/frontend-vue/app/build/matrix/MatrixLanguageHeader.vue +2 -2
- package/frontend-vue/app/components/LanguageNamespaces.vue +10 -4
- package/frontend-vue/app/components/NamespaceCoverage.vue +10 -4
- package/frontend-vue/app/components/TranslationMatrix.vue +48 -59
- package/frontend-vue/app/components/TranslationQueue.vue +15 -8
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +6 -2
- package/frontend-vue/app/components/WorkspaceGeneral.vue +11 -3
- package/frontend-vue/app/components/WorkspaceList.vue +38 -26
- package/frontend-vue/app/components/WorkspaceScope.vue +26 -23
- 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 -36
- package/frontend-vue/package.json +7 -7
- package/package.json +16 -16
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useLanguageActions } from '../composables/translation/useLanguageActions'
|
|
3
|
+
import { useLocaleNames } from '../composables/translation/useLocaleNames'
|
|
4
|
+
import {
|
|
5
|
+
useWorkspaceActions,
|
|
6
|
+
useWorkspaceTypes,
|
|
7
|
+
} from '../composables/translation/useWorkspaceActions'
|
|
8
|
+
import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
|
|
9
|
+
import { useWorkspaceRoute } from '../composables/translation/useWorkspaceRoute'
|
|
2
10
|
import UButton from '@nuxt/ui/components/Button.vue'
|
|
3
11
|
import type { WorkspaceType } from '../types/lang'
|
|
4
12
|
import type { SaveState } from '../utils/keySaves'
|
|
@@ -113,7 +121,7 @@ usePageHeaderActions(() =>
|
|
|
113
121
|
</script>
|
|
114
122
|
|
|
115
123
|
<template>
|
|
116
|
-
<
|
|
124
|
+
<DmsSectionPanel
|
|
117
125
|
v-if="!isUnknown"
|
|
118
126
|
:title="$t('dms_lang.workspace.general_title')"
|
|
119
127
|
:description="
|
|
@@ -152,7 +160,7 @@ usePageHeaderActions(() =>
|
|
|
152
160
|
:label="$t('dms_lang.workspace_details.description_label')"
|
|
153
161
|
:description="$t('dms_lang.workspace_details.description_help')"
|
|
154
162
|
>
|
|
155
|
-
<
|
|
163
|
+
<DmsInputTextarea
|
|
156
164
|
v-if="canEditDetails"
|
|
157
165
|
v-model="description"
|
|
158
166
|
:rows="DESCRIPTION_ROWS"
|
|
@@ -256,5 +264,5 @@ usePageHeaderActions(() =>
|
|
|
256
264
|
@click="addLanguage()"
|
|
257
265
|
/>
|
|
258
266
|
</DmsFieldRow>
|
|
259
|
-
</
|
|
267
|
+
</DmsSectionPanel>
|
|
260
268
|
</template>
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useLangFormat } from '../composables/translation/useLangFormat'
|
|
3
|
+
import {
|
|
4
|
+
PAGE_ACTIONS,
|
|
5
|
+
useLangLinks,
|
|
6
|
+
} from '../composables/translation/useLangLinks'
|
|
7
|
+
import {
|
|
8
|
+
useWorkspaceActions,
|
|
9
|
+
useWorkspaceTypes,
|
|
10
|
+
} from '../composables/translation/useWorkspaceActions'
|
|
11
|
+
import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
|
|
12
|
+
import { useWorkspaceLabel } from '../composables/translation/useWorkspaceLabel'
|
|
13
|
+
import { useWorkspaceRoute } from '../composables/translation/useWorkspaceRoute'
|
|
2
14
|
import UButton from '@nuxt/ui/components/Button.vue'
|
|
3
15
|
import type { WorkspaceKind, WorkspaceStats } from '../types/lang'
|
|
4
16
|
import { COVERAGE_TEXT_CLASSES, coverageTone } from '../utils/coverage'
|
|
@@ -9,7 +21,10 @@ import {
|
|
|
9
21
|
} from '../utils/workspaces'
|
|
10
22
|
import type { WorkspaceSort } from '../utils/workspaces'
|
|
11
23
|
import LocaleTile from '../build/components/LocaleTile.vue'
|
|
12
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
useI18nWorkspaces,
|
|
26
|
+
useWorkspaceSummary,
|
|
27
|
+
} from '../composables/translation/useI18nWorkspaces'
|
|
13
28
|
|
|
14
29
|
interface WorkspaceStat {
|
|
15
30
|
id: string
|
|
@@ -153,10 +168,7 @@ function kindPill(workspace: WorkspaceStats): WorkspacePill {
|
|
|
153
168
|
}
|
|
154
169
|
|
|
155
170
|
function labelsOf(workspace: WorkspaceStats): string[] {
|
|
156
|
-
return [
|
|
157
|
-
kindPill(workspace).label,
|
|
158
|
-
labelOf(workspace),
|
|
159
|
-
]
|
|
171
|
+
return [kindPill(workspace).label, labelOf(workspace)]
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
function localeCodes(workspace: WorkspaceStats): string[] {
|
|
@@ -184,16 +196,17 @@ function create() {
|
|
|
184
196
|
return createWorkspace()
|
|
185
197
|
}
|
|
186
198
|
|
|
187
|
-
usePageHeaderActions(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
usePageHeaderActions(
|
|
200
|
+
() =>
|
|
201
|
+
canCreate.value
|
|
202
|
+
? h(UButton, {
|
|
203
|
+
label: t('dms_lang.workspace_import.open'),
|
|
204
|
+
icon: 'i-ph-upload-simple',
|
|
205
|
+
color: 'neutral',
|
|
206
|
+
variant: 'outline',
|
|
207
|
+
onClick: importWorkspace,
|
|
208
|
+
})
|
|
209
|
+
: null,
|
|
197
210
|
{ order: -1 },
|
|
198
211
|
)
|
|
199
212
|
|
|
@@ -206,12 +219,11 @@ watch(
|
|
|
206
219
|
},
|
|
207
220
|
{ immediate: true },
|
|
208
221
|
)
|
|
209
|
-
|
|
210
222
|
</script>
|
|
211
223
|
|
|
212
224
|
<template>
|
|
213
225
|
<div class="space-y-4">
|
|
214
|
-
<
|
|
226
|
+
<DmsNoticeBanner
|
|
215
227
|
v-if="isLoaded && !editable"
|
|
216
228
|
tone="info"
|
|
217
229
|
icon="i-ph-lock-simple"
|
|
@@ -221,7 +233,7 @@ watch(
|
|
|
221
233
|
<template #actions>
|
|
222
234
|
<DmsCopyButton :value="EDITABLE_CONFIG" />
|
|
223
235
|
</template>
|
|
224
|
-
</
|
|
236
|
+
</DmsNoticeBanner>
|
|
225
237
|
|
|
226
238
|
<DmsEmptyState
|
|
227
239
|
v-if="hasError && !isLoaded"
|
|
@@ -284,7 +296,7 @@ watch(
|
|
|
284
296
|
|
|
285
297
|
<div class="grid gap-4 lg:grid-cols-2">
|
|
286
298
|
<template v-if="!isLoaded && !hasError">
|
|
287
|
-
<
|
|
299
|
+
<DmsCardPanel
|
|
288
300
|
v-for="index in 4"
|
|
289
301
|
:key="index"
|
|
290
302
|
padded
|
|
@@ -294,10 +306,10 @@ watch(
|
|
|
294
306
|
<USkeleton class="h-10 w-full" />
|
|
295
307
|
<USkeleton class="h-6 w-2/3" />
|
|
296
308
|
</div>
|
|
297
|
-
</
|
|
309
|
+
</DmsCardPanel>
|
|
298
310
|
</template>
|
|
299
311
|
|
|
300
|
-
<
|
|
312
|
+
<DmsCardPanel
|
|
301
313
|
v-for="workspace in shown"
|
|
302
314
|
:key="workspace.id"
|
|
303
315
|
:padded="false"
|
|
@@ -332,7 +344,7 @@ watch(
|
|
|
332
344
|
<p class="text-muted mt-0.5 line-clamp-2 text-xs">
|
|
333
345
|
{{
|
|
334
346
|
workspace.description ||
|
|
335
|
-
|
|
347
|
+
$t(`dms_lang.workspace_kinds.${workspace.kind}.description`)
|
|
336
348
|
}}
|
|
337
349
|
</p>
|
|
338
350
|
</div>
|
|
@@ -351,7 +363,7 @@ watch(
|
|
|
351
363
|
v-for="stat in statsOf(workspace)"
|
|
352
364
|
:key="stat.id"
|
|
353
365
|
>
|
|
354
|
-
<
|
|
366
|
+
<DmsEyebrowLabel
|
|
355
367
|
as="dt"
|
|
356
368
|
:label="stat.label"
|
|
357
369
|
size="xs"
|
|
@@ -369,7 +381,7 @@ watch(
|
|
|
369
381
|
<span
|
|
370
382
|
v-for="code in localeCodes(workspace)"
|
|
371
383
|
:key="code"
|
|
372
|
-
class="border-default inline-flex items-center gap-1.5 rounded-md border py-0.5
|
|
384
|
+
class="border-default inline-flex items-center gap-1.5 rounded-md border py-0.5 pl-0.5 pr-2 font-mono text-xs"
|
|
373
385
|
>
|
|
374
386
|
<LocaleTile
|
|
375
387
|
:code="code"
|
|
@@ -437,12 +449,12 @@ watch(
|
|
|
437
449
|
/>
|
|
438
450
|
</div>
|
|
439
451
|
</template>
|
|
440
|
-
</
|
|
452
|
+
</DmsCardPanel>
|
|
441
453
|
|
|
442
454
|
<button
|
|
443
455
|
v-if="isLoaded && canCreate"
|
|
444
456
|
type="button"
|
|
445
|
-
class="border-default text-muted hover:border-primary/50 hover:text-highlighted flex min-h-56 flex-col items-center justify-center gap-3
|
|
457
|
+
class="border-default text-muted hover:border-primary/50 hover:text-highlighted rounded-(--dms-radius-card) flex min-h-56 flex-col items-center justify-center gap-3 border border-dashed p-6 text-center transition-colors"
|
|
446
458
|
@click="create"
|
|
447
459
|
>
|
|
448
460
|
<DmsIconWell
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useFirstRun } from '../composables/translation/useFirstRun'
|
|
3
|
+
import { useI18nWorkspaces } from '../composables/translation/useI18nWorkspaces'
|
|
4
|
+
import { useLangFormat } from '../composables/translation/useLangFormat'
|
|
5
|
+
import {
|
|
6
|
+
PAGE_ACTIONS,
|
|
7
|
+
PAGE_ACTION_QUERY,
|
|
8
|
+
useLangLinks,
|
|
9
|
+
} from '../composables/translation/useLangLinks'
|
|
10
|
+
import { useLanguageActions } from '../composables/translation/useLanguageActions'
|
|
11
|
+
import { useLocaleNames } from '../composables/translation/useLocaleNames'
|
|
12
|
+
import { useWorkspaceTypes } from '../composables/translation/useWorkspaceActions'
|
|
13
|
+
import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
|
|
14
|
+
import { useWorkspaceFill } from '../composables/translation/useWorkspaceFill'
|
|
15
|
+
import { useWorkspaceLabel } from '../composables/translation/useWorkspaceLabel'
|
|
16
|
+
import { useWorkspaceRoute } from '../composables/translation/useWorkspaceRoute'
|
|
2
17
|
import { useLangChanges } from '../composables/translation/useWorkspaceFlat'
|
|
3
18
|
import type { DropdownMenuItem } from '@nuxt/ui'
|
|
4
19
|
import type { WorkspaceSummary } from '../types/lang'
|
|
@@ -13,23 +28,12 @@ const MENU_FILTER_FIELDS = ['label', 'description', 'workspaceId', 'summary']
|
|
|
13
28
|
const { t } = useI18n()
|
|
14
29
|
const { formatCount } = useLangFormat()
|
|
15
30
|
const { workspaces, editable, isLoaded, whenLoaded } = useI18nWorkspaces()
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
isEditable,
|
|
19
|
-
isModules,
|
|
20
|
-
isAdded,
|
|
21
|
-
isUnknown,
|
|
22
|
-
isResolved,
|
|
23
|
-
} = useWorkspaceContext()
|
|
31
|
+
const { current, isEditable, isModules, isAdded, isUnknown, isResolved } =
|
|
32
|
+
useWorkspaceContext()
|
|
24
33
|
const { labelOf } = useWorkspaceLabel()
|
|
25
34
|
useLangChanges()
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
queryWorkspace,
|
|
29
|
-
pageAction,
|
|
30
|
-
clearPageAction,
|
|
31
|
-
currentPage,
|
|
32
|
-
} = useWorkspaceRoute()
|
|
35
|
+
const { switchLink, queryWorkspace, pageAction, clearPageAction, currentPage } =
|
|
36
|
+
useWorkspaceRoute()
|
|
33
37
|
|
|
34
38
|
/** What the bar says about the workspace shown, from the workspace list. */
|
|
35
39
|
const scope = computed(() => ({
|
|
@@ -194,7 +198,7 @@ watch(
|
|
|
194
198
|
class="space-y-3"
|
|
195
199
|
>
|
|
196
200
|
<div
|
|
197
|
-
class="dms-card flex flex-wrap items-center gap-x-3.5 gap-y-2.5 py-2 pr-3.5
|
|
201
|
+
class="dms-card flex flex-wrap items-center gap-x-3.5 gap-y-2.5 py-2 pl-2 pr-3.5"
|
|
198
202
|
>
|
|
199
203
|
<UDropdownMenu
|
|
200
204
|
:items="menuItems"
|
|
@@ -227,7 +231,7 @@ watch(
|
|
|
227
231
|
</template>
|
|
228
232
|
<button
|
|
229
233
|
type="button"
|
|
230
|
-
class="hover:bg-elevated/60 hover:border-default flex h-11 items-center gap-2.5 rounded-md border border-transparent
|
|
234
|
+
class="hover:bg-elevated/60 hover:border-default flex h-11 items-center gap-2.5 rounded-md border border-transparent pl-1.5 pr-2.5 text-left transition-colors"
|
|
231
235
|
:aria-label="$t('dms_lang.scope.switch')"
|
|
232
236
|
>
|
|
233
237
|
<DmsIconWell
|
|
@@ -236,7 +240,7 @@ watch(
|
|
|
236
240
|
size="sm"
|
|
237
241
|
/>
|
|
238
242
|
<span class="grid gap-px">
|
|
239
|
-
<
|
|
243
|
+
<DmsEyebrowLabel
|
|
240
244
|
:label="$t('dms_lang.scope.workspace')"
|
|
241
245
|
size="xs"
|
|
242
246
|
/>
|
|
@@ -246,7 +250,7 @@ watch(
|
|
|
246
250
|
/>
|
|
247
251
|
<span
|
|
248
252
|
v-else
|
|
249
|
-
class="text-highlighted text-sm leading-tight
|
|
253
|
+
class="text-highlighted text-sm font-semibold leading-tight"
|
|
250
254
|
>
|
|
251
255
|
{{ workspaceLabel(current) }}
|
|
252
256
|
</span>
|
|
@@ -340,7 +344,7 @@ watch(
|
|
|
340
344
|
</p>
|
|
341
345
|
</div>
|
|
342
346
|
|
|
343
|
-
<
|
|
347
|
+
<DmsNoticeBanner
|
|
344
348
|
v-if="showReadOnlyServer"
|
|
345
349
|
tone="warning"
|
|
346
350
|
size="sm"
|
|
@@ -349,7 +353,7 @@ watch(
|
|
|
349
353
|
:description="$t('dms_lang.scope.server_read_only_description')"
|
|
350
354
|
/>
|
|
351
355
|
|
|
352
|
-
<
|
|
356
|
+
<DmsCardPanel
|
|
353
357
|
v-if="isFirstRun"
|
|
354
358
|
:padded="false"
|
|
355
359
|
>
|
|
@@ -368,7 +372,6 @@ watch(
|
|
|
368
372
|
/>
|
|
369
373
|
</template>
|
|
370
374
|
</DmsEmptyState>
|
|
371
|
-
</
|
|
375
|
+
</DmsCardPanel>
|
|
372
376
|
</div>
|
|
373
377
|
</template>
|
|
374
|
-
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import KeyAddModal from '../../build/components/KeyAddModal.vue'
|
|
2
2
|
import KeyRenameModal from '../../build/components/KeyRenameModal.vue'
|
|
3
3
|
import type { FlatTranslationRow, KeyRowResponse } from '../../types/lang'
|
|
4
|
+
import {
|
|
5
|
+
isLocaleValueMissing,
|
|
6
|
+
nextSiblingPath,
|
|
7
|
+
stringValue,
|
|
8
|
+
} from '../../utils/translations.ts'
|
|
9
|
+
import { useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
10
|
+
import { useMutationToast } from './useMutationToast.ts'
|
|
11
|
+
import { useWorkspaceContext } from './useWorkspaceContext.ts'
|
|
12
|
+
import { useWorkspaceFlat } from './useWorkspaceFlat.ts'
|
|
13
|
+
import { useWorkspaceLabel } from './useWorkspaceLabel.ts'
|
|
4
14
|
|
|
5
15
|
/** What the key actions share: the selected workspace, its keys and the DMS helpers. */
|
|
6
16
|
interface KeyActionsContext {
|
|
@@ -2,6 +2,11 @@ import type { Ref } from 'vue'
|
|
|
2
2
|
import { until } from '@vueuse/core'
|
|
3
3
|
import { useDmsState } from '#dms/frontend-module'
|
|
4
4
|
import LanguageAddModal from '../../build/components/LanguageAddModal.vue'
|
|
5
|
+
import { languageUrl, useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
6
|
+
import { useLangFormat } from './useLangFormat.ts'
|
|
7
|
+
import { useLocaleNames } from './useLocaleNames.ts'
|
|
8
|
+
import { useWorkspaceContext } from './useWorkspaceContext.ts'
|
|
9
|
+
import { useWorkspaceFlat } from './useWorkspaceFlat.ts'
|
|
5
10
|
|
|
6
11
|
/** What the language actions share: the selected workspace and the DMS helpers. */
|
|
7
12
|
interface LanguageActionsContext {
|
|
@@ -53,7 +58,9 @@ async function openAddModal(context: LanguageActionsContext): Promise<boolean> {
|
|
|
53
58
|
props: {
|
|
54
59
|
workspace: context.workspaces.selectedWorkspace.value,
|
|
55
60
|
existing: codesOf(context),
|
|
56
|
-
baseName: context.nativeName(
|
|
61
|
+
baseName: context.nativeName(
|
|
62
|
+
context.current.value?.defaultLocale ?? '',
|
|
63
|
+
),
|
|
57
64
|
},
|
|
58
65
|
})
|
|
59
66
|
return (await modal.open()) === true
|
|
@@ -132,7 +139,9 @@ async function makeBase(
|
|
|
132
139
|
await context.translations.refresh()
|
|
133
140
|
notify(
|
|
134
141
|
context,
|
|
135
|
-
context.t('dms_lang.language_base.done', {
|
|
142
|
+
context.t('dms_lang.language_base.done', {
|
|
143
|
+
name: context.nativeName(code),
|
|
144
|
+
}),
|
|
136
145
|
)
|
|
137
146
|
return true
|
|
138
147
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { ComputedRef } from 'vue'
|
|
2
2
|
import { useDmsRouter } from '#dms/frontend-module'
|
|
3
3
|
import type { FlatTranslationRow, FlatTranslations } from '../../types/lang'
|
|
4
|
+
import type { PageQuery } from './useLangLinks'
|
|
5
|
+
import { namespaceCoverage } from '../../utils/coverage.ts'
|
|
6
|
+
import {
|
|
7
|
+
isRowValueMissing,
|
|
8
|
+
namespaceOf,
|
|
9
|
+
needsReview,
|
|
10
|
+
} from '../../utils/translations.ts'
|
|
11
|
+
import { linkWithQuery } from './useLangLinks.ts'
|
|
12
|
+
import { useWorkspaceFlat } from './useWorkspaceFlat.ts'
|
|
13
|
+
import { useWorkspaceRoute } from './useWorkspaceRoute.ts'
|
|
4
14
|
|
|
5
15
|
export type QueueMode = 'missing' | 'issues' | 'all'
|
|
6
16
|
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
type QueueDrafts,
|
|
17
17
|
type SentDraft,
|
|
18
18
|
} from '../../utils/queueDrafts'
|
|
19
|
+
import type { LangPage } from './useLangLinks'
|
|
20
|
+
import { useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
21
|
+
import { langPageOf } from './useLangLinks.ts'
|
|
22
|
+
import { useWorkspaceRoute } from './useWorkspaceRoute.ts'
|
|
19
23
|
|
|
20
24
|
const QUEUE_PAGE: LangPage = 'language'
|
|
21
25
|
|
|
@@ -19,6 +19,12 @@ import {
|
|
|
19
19
|
} from '../../utils/queuePass'
|
|
20
20
|
import type { QueueDraftStore } from './useQueueDrafts'
|
|
21
21
|
import type { LanguageQueue } from './useLanguageQueue'
|
|
22
|
+
import { coveragePercent } from '../../utils/coverage.ts'
|
|
23
|
+
import { useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
24
|
+
import { useLanguageQueue } from './useLanguageQueue.ts'
|
|
25
|
+
import { useQueueDrafts } from './useQueueDrafts.ts'
|
|
26
|
+
import { useWorkspaceFlat } from './useWorkspaceFlat.ts'
|
|
27
|
+
import { useWorkspaceRoute } from './useWorkspaceRoute.ts'
|
|
22
28
|
|
|
23
29
|
export interface QueueEntry {
|
|
24
30
|
row: FlatTranslationRow
|
|
@@ -8,6 +8,12 @@ import {
|
|
|
8
8
|
} from '../../utils/workspaceBackup'
|
|
9
9
|
import WorkspaceCreateModal from '../../build/components/WorkspaceCreateModal.vue'
|
|
10
10
|
import WorkspaceRenameModal from '../../build/components/WorkspaceRenameModal.vue'
|
|
11
|
+
import { downloadJson } from '../../utils/download.ts'
|
|
12
|
+
import { DEFAULT_WORKSPACE, useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
13
|
+
import { useLangFormat } from './useLangFormat.ts'
|
|
14
|
+
import { useLangLinks } from './useLangLinks.ts'
|
|
15
|
+
import { useMutationToast } from './useMutationToast.ts'
|
|
16
|
+
import { useWorkspaceRoute } from './useWorkspaceRoute.ts'
|
|
11
17
|
|
|
12
18
|
const JSON_FILE_TYPES = '.json,application/json'
|
|
13
19
|
const WORKSPACE_DESCRIPTION_MAX = 500
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { useDmsRouter, useDmsState } from '#dms/frontend-module'
|
|
2
|
+
import { DEFAULT_WORKSPACE, useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
3
|
+
import { linkWithQuery } from './useLangLinks.ts'
|
|
4
|
+
import { useWorkspaceContext } from './useWorkspaceContext.ts'
|
|
5
|
+
import { useWorkspaceRoute } from './useWorkspaceRoute.ts'
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* Gives a page opened without `?workspace=` (a menu link, a new tab) the
|
|
@@ -7,6 +7,11 @@ import type {
|
|
|
7
7
|
KeyRowResponse,
|
|
8
8
|
} from '../../types/lang'
|
|
9
9
|
import { EMPTY_FLAT, withRow } from '../../utils/coverage'
|
|
10
|
+
import {
|
|
11
|
+
ENDPOINTS,
|
|
12
|
+
MODULES_WORKSPACE,
|
|
13
|
+
useI18nWorkspaces,
|
|
14
|
+
} from './useI18nWorkspaces.ts'
|
|
10
15
|
|
|
11
16
|
/** Realtime topic the backend publishes on after each write. */
|
|
12
17
|
export const LANG_REALTIME_TOPIC = 'dms-lang.translations'
|
|
@@ -114,23 +119,25 @@ function useFlatRead(
|
|
|
114
119
|
return id ? flatKey(id) : null
|
|
115
120
|
}
|
|
116
121
|
// The first run starts within the call, before its result is returned.
|
|
117
|
-
|
|
122
|
+
const holder: { read?: FlatRead } = {}
|
|
118
123
|
const read = useApiData<FlatTranslations>(
|
|
119
124
|
key,
|
|
120
125
|
({ $authFetch, signal }): Promise<FlatTranslations> =>
|
|
121
126
|
readFlat({
|
|
122
127
|
workspace: toValue(workspace),
|
|
123
|
-
current:
|
|
128
|
+
current:
|
|
129
|
+
holder.read && !holder.read.placeholder.value
|
|
130
|
+
? holder.read.data.value
|
|
131
|
+
: null,
|
|
124
132
|
authFetch: $authFetch,
|
|
125
133
|
signal,
|
|
126
134
|
}),
|
|
127
135
|
{ immediate: options.immediate, refreshOnPageRefresh: false },
|
|
128
136
|
)
|
|
129
|
-
|
|
137
|
+
holder.read = read
|
|
130
138
|
return read
|
|
131
139
|
}
|
|
132
140
|
|
|
133
|
-
|
|
134
141
|
function recordChange(workspace: string, payload: ChangedPayload): void {
|
|
135
142
|
const known = changedKeys.get(workspace)
|
|
136
143
|
const isWhole = !payload.keys?.length || known === null
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { WorkspaceSummary } from '../../types/lang'
|
|
2
|
+
import { useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
3
|
+
import { useWorkspaceContext } from './useWorkspaceContext.ts'
|
|
2
4
|
|
|
3
5
|
/** What naming a workspace needs. */
|
|
4
6
|
type NamedWorkspace = Pick<WorkspaceSummary, 'id' | 'kind'>
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { useDmsRoute, useDmsRouter } from '#dms/frontend-module'
|
|
2
|
+
import type { LangPage, PageQuery } from './useLangLinks'
|
|
3
|
+
import { normalizeWorkspaceId, useI18nWorkspaces } from './useI18nWorkspaces.ts'
|
|
4
|
+
import {
|
|
5
|
+
LANG_PAGES,
|
|
6
|
+
PAGE_ACTION_QUERY,
|
|
7
|
+
langPageOf,
|
|
8
|
+
linkWithQuery,
|
|
9
|
+
} from './useLangLinks.ts'
|
|
2
10
|
|
|
3
11
|
export interface SelectWorkspaceOptions {
|
|
4
12
|
/** The page to land on; the current one by default. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TranslationValue } from '../types/lang'
|
|
2
|
+
import { serverErrorCode } from '../composables/translation/useMutationToast.ts'
|
|
2
3
|
|
|
3
4
|
/** Why a key write was refused: changed elsewhere, deleted, a message that does not compile, or anything else. */
|
|
4
5
|
export type KeySaveFailureKind = 'conflict' | 'deleted' | 'invalid' | 'other'
|
|
@@ -81,14 +81,14 @@ const QUOTE = "'"
|
|
|
81
81
|
const LINKED_MARK = '@'
|
|
82
82
|
export const PLURAL_SEPARATOR = '|'
|
|
83
83
|
/** What the scanner reads as a variable, to highlight and rename it. */
|
|
84
|
-
const PLACEHOLDER_NAME = /^(?:[
|
|
84
|
+
const PLACEHOLDER_NAME = /^(?:[a-z_][\w$-]*|\d+)$/i
|
|
85
85
|
const LITERAL_PATTERN = /\s*'((?:[^'\\\n]|\\.)*)'\s*\}/y
|
|
86
86
|
const LITERAL_ESCAPE = /\\u([0-9a-fA-F]{4})|\\(.)/g
|
|
87
|
-
const LINKED_PATTERN = /@(?:\.[
|
|
87
|
+
const LINKED_PATTERN = /@(?:\.[a-z]+)?:(?:\(([^()\s]+)\)|([\w.$-]+)|(?=\{))/iy
|
|
88
88
|
const IMPLICIT_PLURAL_NAMES = ['count', 'n']
|
|
89
89
|
const LEADING_SPACE = /^\s/
|
|
90
90
|
const TRAILING_SPACE = /\s$/
|
|
91
|
-
const KEY_PATH_PATTERN = /^[\w-]+(
|
|
91
|
+
const KEY_PATH_PATTERN = /^[\w-]+(?:\.[\w-]+)*$/
|
|
92
92
|
const MAX_KEY_SEGMENT_LENGTH = 128
|
|
93
93
|
const FORBIDDEN_KEY_SEGMENTS = new Set([
|
|
94
94
|
'__proto__',
|
|
@@ -74,6 +74,11 @@ function backendSourceFile(id: string): string | undefined {
|
|
|
74
74
|
: undefined
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/** `path` with `/` separators, the form Vite gives an importer, so a boundary error names both paths alike on every OS. */
|
|
78
|
+
function forwardSlashes(path: string): string {
|
|
79
|
+
return path.split(sep).join('/')
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
/**
|
|
78
83
|
* Fails the build and the dev server when a module of the frontend resolves to
|
|
79
84
|
* a file under the `src` of the backend package: the browser reaches the
|
|
@@ -113,9 +118,9 @@ function boundaryCheck(): VitePlugin {
|
|
|
113
118
|
const from =
|
|
114
119
|
importer === undefined
|
|
115
120
|
? 'an entry point'
|
|
116
|
-
: importer.replace(QUERY_OR_HASH, '')
|
|
121
|
+
: forwardSlashes(importer.replace(QUERY_OR_HASH, ''))
|
|
117
122
|
return this.error(
|
|
118
|
-
`Backend boundary: ${from} imports ${file}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
|
|
123
|
+
`Backend boundary: ${from} imports ${forwardSlashes(file)}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
|
|
119
124
|
)
|
|
120
125
|
},
|
|
121
126
|
}
|
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import vue from 'eslint-plugin-vue'
|
|
2
|
+
import { antelopeNuxtConfig } from '@antelopejs/tooling-configs/eslint'
|
|
3
|
+
import dmsGlobals from '@antelopejs/dms/eslint-globals'
|
|
4
|
+
import rendererGlobals from '@antelopejs/dms-frontend/eslint-globals'
|
|
6
5
|
import globals from 'globals'
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
languageOptions: {
|
|
21
|
-
globals: { ...globals.browser, ...globals.node },
|
|
22
|
-
parserOptions: {
|
|
23
|
-
parser: typescriptParser,
|
|
24
|
-
sourceType: 'module',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
plugins: { '@typescript-eslint': typescript },
|
|
28
|
-
rules: {
|
|
29
|
-
'no-undef': 'off',
|
|
30
|
-
'no-unused-vars': 'off',
|
|
31
|
-
'@typescript-eslint/no-unused-vars': [
|
|
32
|
-
'error',
|
|
33
|
-
{
|
|
34
|
-
argsIgnorePattern: '^_',
|
|
35
|
-
varsIgnorePattern: '^_',
|
|
36
|
-
caughtErrorsIgnorePattern: '^_',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
7
|
+
/**
|
|
8
|
+
* The AntelopeJS Nuxt preset. Prettier owns the template layout, so void
|
|
9
|
+
* elements self-close the way Prettier writes them.
|
|
10
|
+
*/
|
|
11
|
+
export default antelopeNuxtConfig().append({
|
|
12
|
+
files: ['**/*.{js,mjs,cjs,ts,vue}'],
|
|
13
|
+
languageOptions: {
|
|
14
|
+
globals: {
|
|
15
|
+
...globals.browser,
|
|
16
|
+
...globals.node,
|
|
17
|
+
...rendererGlobals,
|
|
18
|
+
...dmsGlobals,
|
|
39
19
|
},
|
|
40
20
|
},
|
|
41
|
-
|
|
21
|
+
rules: {
|
|
22
|
+
'no-undef': 'error',
|
|
23
|
+
'vue/html-self-closing': ['error', { html: { void: 'always' } }],
|
|
24
|
+
},
|
|
25
|
+
})
|