@antelopejs/dms-lang 0.0.6 → 0.1.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 +12 -6
- package/dist/pages/actions.d.ts +7 -0
- package/dist/pages/actions.js +15 -0
- package/dist/pages/actions.js.map +1 -0
- package/dist/pages/component-action.d.ts +2 -0
- package/dist/pages/component-action.js +10 -0
- package/dist/pages/component-action.js.map +1 -0
- package/dist/pages/header-actions.d.ts +9 -0
- package/dist/pages/header-actions.js +146 -0
- package/dist/pages/header-actions.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +6 -0
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/language.d.ts +10 -0
- package/dist/pages/language.js +89 -0
- package/dist/pages/language.js.map +1 -0
- package/dist/pages/languages-table.d.ts +2 -0
- package/dist/pages/languages-table.js +120 -0
- package/dist/pages/languages-table.js.map +1 -0
- package/dist/pages/module.d.ts +7 -1
- package/dist/pages/module.js +28 -2
- package/dist/pages/module.js.map +1 -1
- package/dist/pages/overview.d.ts +2 -1
- package/dist/pages/overview.js +83 -8
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/page-actions.d.ts +6 -0
- package/dist/pages/page-actions.js +10 -0
- package/dist/pages/page-actions.js.map +1 -0
- package/dist/pages/quick-actions.d.ts +1 -0
- package/dist/pages/quick-actions.js +56 -0
- package/dist/pages/quick-actions.js.map +1 -0
- package/dist/pages/translations.d.ts +7 -1
- package/dist/pages/translations.js +47 -10
- package/dist/pages/translations.js.map +1 -1
- package/dist/pages/workspace-guard.d.ts +1 -0
- package/dist/pages/workspace-guard.js +35 -0
- package/dist/pages/workspace-guard.js.map +1 -0
- package/dist/pages/workspace.d.ts +18 -0
- package/dist/pages/workspace.js +162 -0
- package/dist/pages/workspace.js.map +1 -0
- package/dist/pages/workspaces.d.ts +14 -0
- package/dist/pages/workspaces.js +88 -0
- package/dist/pages/workspaces.js.map +1 -0
- package/dist/routes/publicLocales.d.ts +3 -2
- package/dist/routes/publicLocales.js +39 -18
- package/dist/routes/publicLocales.js.map +1 -1
- package/dist/routes/translations.d.ts +59 -63
- package/dist/routes/translations.js +400 -119
- package/dist/routes/translations.js.map +1 -1
- package/dist/utils/announce.d.ts +9 -0
- package/dist/utils/announce.js +29 -0
- package/dist/utils/announce.js.map +1 -0
- package/dist/utils/blocks.d.ts +8 -0
- package/dist/utils/blocks.js +213 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/body.d.ts +1 -0
- package/dist/utils/body.js +21 -0
- package/dist/utils/body.js.map +1 -0
- package/dist/utils/cache.d.ts +3 -0
- package/dist/utils/cache.js +32 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/catalog.d.ts +7 -0
- package/dist/utils/catalog.js +62 -0
- package/dist/utils/catalog.js.map +1 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +10 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/coverage.d.ts +2 -0
- package/dist/utils/coverage.js +11 -0
- package/dist/utils/coverage.js.map +1 -0
- package/dist/utils/dialogs.d.ts +7 -0
- package/dist/utils/dialogs.js +103 -0
- package/dist/utils/dialogs.js.map +1 -0
- package/dist/utils/errors.d.ts +40 -0
- package/dist/utils/errors.js +60 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/export.d.ts +17 -0
- package/dist/utils/export.js +129 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/json.d.ts +10 -1
- package/dist/utils/json.js +127 -19
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/key-stores.d.ts +3 -0
- package/dist/utils/key-stores.js +24 -0
- package/dist/utils/key-stores.js.map +1 -0
- package/dist/utils/keys.d.ts +23 -0
- package/dist/utils/keys.js +252 -0
- package/dist/utils/keys.js.map +1 -0
- package/dist/utils/languages.d.ts +27 -0
- package/dist/utils/languages.js +121 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/locale-codes.d.ts +5 -0
- package/dist/utils/locale-codes.js +56 -0
- package/dist/utils/locale-codes.js.map +1 -0
- package/dist/utils/locale-discovery.d.ts +1 -0
- package/dist/utils/locale-discovery.js +19 -1
- package/dist/utils/locale-discovery.js.map +1 -1
- package/dist/utils/message-check.d.ts +1 -0
- package/dist/utils/message-check.js +93 -0
- package/dist/utils/message-check.js.map +1 -0
- package/dist/utils/message-syntax.d.ts +6 -0
- package/dist/utils/message-syntax.js +38 -0
- package/dist/utils/message-syntax.js.map +1 -0
- package/dist/utils/namespaces.d.ts +12 -0
- package/dist/utils/namespaces.js +52 -0
- package/dist/utils/namespaces.js.map +1 -0
- package/dist/utils/notices.d.ts +4 -0
- package/dist/utils/notices.js +60 -0
- package/dist/utils/notices.js.map +1 -0
- package/dist/utils/own.d.ts +2 -3
- package/dist/utils/own.js +17 -57
- package/dist/utils/own.js.map +1 -1
- package/dist/utils/public-url.d.ts +8 -0
- package/dist/utils/public-url.js +87 -0
- package/dist/utils/public-url.js.map +1 -0
- package/dist/utils/registry.d.ts +3 -1
- package/dist/utils/registry.js +26 -10
- package/dist/utils/registry.js.map +1 -1
- package/dist/utils/resolve.d.ts +18 -15
- package/dist/utils/resolve.js +98 -151
- package/dist/utils/resolve.js.map +1 -1
- package/dist/utils/review.d.ts +5 -0
- package/dist/utils/review.js +64 -0
- package/dist/utils/review.js.map +1 -0
- package/dist/utils/snippets.d.ts +7 -0
- package/dist/utils/snippets.js +129 -0
- package/dist/utils/snippets.js.map +1 -0
- package/dist/utils/summary.d.ts +23 -0
- package/dist/utils/summary.js +65 -0
- package/dist/utils/summary.js.map +1 -0
- package/dist/utils/tree.d.ts +2 -17
- package/dist/utils/tree.js +21 -126
- package/dist/utils/tree.js.map +1 -1
- package/dist/utils/workspaces.d.ts +45 -15
- package/dist/utils/workspaces.js +256 -164
- package/dist/utils/workspaces.js.map +1 -1
- package/dist/validation/key.schema.d.ts +71 -0
- package/dist/validation/key.schema.js +67 -0
- package/dist/validation/key.schema.js.map +1 -0
- package/dist/validation/query.schema.d.ts +17 -0
- package/dist/validation/query.schema.js +44 -0
- package/dist/validation/query.schema.js.map +1 -0
- package/dist/validation/validate.d.ts +2 -0
- package/dist/validation/validate.js +24 -0
- package/dist/validation/validate.js.map +1 -0
- package/dist/validation/workspace.schema.d.ts +145 -0
- package/dist/validation/workspace.schema.js +83 -0
- package/dist/validation/workspace.schema.js.map +1 -0
- package/frontend-vue/app/build/components/KeyAddModal.vue +340 -0
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +951 -0
- package/frontend-vue/app/build/components/KeyRenameModal.vue +172 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +199 -0
- package/frontend-vue/app/build/components/LanguagePicker.vue +233 -0
- package/frontend-vue/app/build/components/LocaleTile.vue +52 -0
- package/frontend-vue/app/build/components/PlaceholderText.vue +42 -0
- package/frontend-vue/app/build/components/ShortcutKbds.vue +22 -0
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +193 -0
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +107 -0
- package/frontend-vue/app/build/components/form/FormFieldRow.vue +70 -0
- package/frontend-vue/app/build/components/form/FormRows.vue +25 -0
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +44 -0
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +488 -0
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +177 -0
- package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +57 -0
- package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +83 -0
- package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +167 -0
- package/frontend-vue/app/build/components/queue/QueueActions.vue +60 -0
- package/frontend-vue/app/build/components/queue/QueueDone.vue +185 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +374 -0
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +162 -0
- package/frontend-vue/app/build/components/queue/QueueUpNext.vue +61 -0
- package/frontend-vue/app/build/composables/useCellEditor.ts +324 -0
- package/frontend-vue/app/build/composables/useCellMoves.ts +155 -0
- package/frontend-vue/app/build/composables/useCellSaves.ts +339 -0
- package/frontend-vue/app/build/composables/useKeyPanel.ts +284 -0
- package/frontend-vue/app/build/composables/useKeySaves.ts +280 -0
- package/frontend-vue/app/build/composables/useMatrixFilters.ts +213 -0
- package/frontend-vue/app/build/composables/useMatrixRows.ts +104 -0
- package/frontend-vue/app/build/composables/useMatrixView.ts +181 -0
- package/frontend-vue/app/build/composables/useQueueContext.ts +31 -0
- package/frontend-vue/app/build/composables/useQueueEditing.ts +53 -0
- package/frontend-vue/app/build/composables/useQueueOrphans.ts +54 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +290 -0
- package/frontend-vue/app/build/composables/useQueueShortcuts.ts +106 -0
- package/frontend-vue/app/build/composables/useQueueToasts.ts +99 -0
- package/frontend-vue/app/components/LanguageNamespaces.vue +77 -0
- package/frontend-vue/app/components/NamespaceCoverage.vue +222 -0
- package/frontend-vue/app/components/TranslationMatrix.vue +809 -0
- package/frontend-vue/app/components/TranslationQueue.vue +212 -0
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +81 -0
- package/frontend-vue/app/components/WorkspaceGeneral.vue +232 -0
- package/frontend-vue/app/components/WorkspaceList.vue +454 -0
- package/frontend-vue/app/components/WorkspaceScope.vue +384 -0
- package/frontend-vue/app/composables/translation/useFirstRun.ts +8 -0
- package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +221 -133
- package/frontend-vue/app/composables/translation/useKeyActions.ts +224 -0
- package/frontend-vue/app/composables/translation/useLangFormat.ts +10 -0
- package/frontend-vue/app/composables/translation/useLangLinks.ts +80 -0
- package/frontend-vue/app/composables/translation/useLanguageActions.ts +159 -0
- package/frontend-vue/app/composables/translation/useLanguageQueue.ts +232 -0
- package/frontend-vue/app/composables/translation/useLocaleNames.ts +166 -0
- package/frontend-vue/app/composables/translation/useMutationToast.ts +51 -17
- package/frontend-vue/app/composables/translation/useQueueDrafts.ts +115 -0
- package/frontend-vue/app/composables/translation/useQueueSession.ts +182 -0
- package/frontend-vue/app/composables/translation/useServedConfirm.ts +152 -0
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +259 -0
- package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +46 -15
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +322 -70
- package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +55 -0
- package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +129 -0
- package/frontend-vue/app/config/shortcuts-registry.ts +72 -0
- package/frontend-vue/app/types/lang.ts +130 -0
- package/frontend-vue/app/utils/boundedCache.ts +22 -0
- package/frontend-vue/app/utils/download.ts +16 -0
- package/frontend-vue/app/utils/keySaveErrors.ts +61 -0
- package/frontend-vue/app/utils/keySaves.ts +108 -0
- package/frontend-vue/app/utils/languages.ts +272 -0
- package/frontend-vue/app/utils/matrixExport.ts +47 -0
- package/frontend-vue/app/utils/queueDrafts.ts +115 -0
- package/frontend-vue/app/utils/queuePass.ts +145 -0
- package/frontend-vue/app/utils/queueView.ts +22 -0
- package/frontend-vue/app/utils/shortcuts.ts +75 -0
- package/frontend-vue/app/utils/translations.ts +756 -0
- package/frontend-vue/app/utils/workspaceBackup.ts +119 -0
- package/frontend-vue/app/utils/workspaces.ts +45 -0
- package/frontend-vue/dms.frontend.build.ts +5 -0
- package/frontend-vue/dms.frontend.ts +9 -20
- package/frontend-vue/i18n/locales/lang-en-GB.json +792 -69
- package/frontend-vue/i18n/locales/lang-fr-FR.json +792 -69
- package/frontend-vue/package.json +10 -5
- package/package.json +10 -8
- package/dist/utils/mutations.d.ts +0 -3
- package/dist/utils/mutations.js +0 -35
- package/dist/utils/mutations.js.map +0 -1
- package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +0 -284
- package/frontend-vue/app/components/LanguageAddModal.vue +0 -78
- package/frontend-vue/app/components/WorkspaceEndpoint.vue +0 -29
- package/frontend-vue/app/components/WorkspaceSelector.vue +0 -180
- package/frontend-vue/app/components/WorkspaceStatus.vue +0 -24
- package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +0 -90
- package/frontend-vue/app/composables/translation/useLocaleMeta.ts +0 -18
- package/frontend-vue/app/composables/translation/useTranslationProgress.ts +0 -73
- package/frontend-vue/app/custom-pages/lang/overview.vue +0 -397
- package/frontend-vue/app/custom-pages/lang/translations.vue +0 -498
- package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +0 -12
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FlatTranslationRow } from '../../../types/lang'
|
|
3
|
+
import type { MessageIssueKind } from '../../../utils/translations'
|
|
4
|
+
import {
|
|
5
|
+
escapeMessage,
|
|
6
|
+
formatTokens,
|
|
7
|
+
messageIssueText,
|
|
8
|
+
placeholdersOf,
|
|
9
|
+
replacePlaceholder,
|
|
10
|
+
stringValue,
|
|
11
|
+
} from '../../../utils/translations'
|
|
12
|
+
import { textDirection } from '../../../utils/languages'
|
|
13
|
+
import LocaleTile from '../LocaleTile.vue'
|
|
14
|
+
import PlaceholderText from '../PlaceholderText.vue'
|
|
15
|
+
import { useQueue } from '../../composables/useQueueContext'
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
/** The key shown. */
|
|
19
|
+
row: FlatTranslationRow
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The part of the textarea component the editor reaches into. */
|
|
23
|
+
interface TextareaHandle {
|
|
24
|
+
textareaRef?: HTMLTextAreaElement
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** A variable renamed by mistake, and the one to put back in its place. */
|
|
28
|
+
interface TokenReplacement {
|
|
29
|
+
from: string
|
|
30
|
+
to: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const CONTEXT_LANGUAGES = 2
|
|
34
|
+
const LONG_TEXT = 80
|
|
35
|
+
const KEY_SEPARATOR = '.'
|
|
36
|
+
|
|
37
|
+
const props = defineProps<Props>()
|
|
38
|
+
const { t } = useI18n()
|
|
39
|
+
const { flat } = useWorkspaceFlat()
|
|
40
|
+
const { canEditValues, isModules } = useWorkspaceContext()
|
|
41
|
+
const { switchLink } = useWorkspaceRoute()
|
|
42
|
+
const { session, editing, save, languageName, nameOf } = useQueue()
|
|
43
|
+
const { locale, baseLocale, drafts } = session
|
|
44
|
+
const { baseText, draft, issues, isBlocked, conflict, isOutdated } = editing
|
|
45
|
+
const { isSaving, isReviewing, isArmed, rejectedProblems } = save
|
|
46
|
+
|
|
47
|
+
const textarea = useTemplateRef<TextareaHandle>('textarea')
|
|
48
|
+
|
|
49
|
+
const keyParts = computed(() => {
|
|
50
|
+
const key = props.row.key
|
|
51
|
+
const cut = key.lastIndexOf(KEY_SEPARATOR) + 1
|
|
52
|
+
return { path: key.slice(0, cut), leaf: key.slice(cut) }
|
|
53
|
+
})
|
|
54
|
+
const escapedDraft = computed(() => escapeMessage(draft.value))
|
|
55
|
+
const tokensOf = (kind: MessageIssueKind) =>
|
|
56
|
+
issues.value
|
|
57
|
+
.filter((issue) => issue.kind === kind)
|
|
58
|
+
.flatMap((issue) => issue.tokens)
|
|
59
|
+
const missingTokens = computed(() => tokensOf('missing'))
|
|
60
|
+
const replacement = computed<TokenReplacement | undefined>(() => {
|
|
61
|
+
const extra = tokensOf('extra')
|
|
62
|
+
if (missingTokens.value.length !== 1 || extra.length !== 1) return undefined
|
|
63
|
+
return { from: extra[0], to: missingTokens.value[0] }
|
|
64
|
+
})
|
|
65
|
+
const tokens = computed(() => placeholdersOf(baseText.value))
|
|
66
|
+
const fieldColor = computed(() => {
|
|
67
|
+
if (isBlocked.value) return 'error'
|
|
68
|
+
return issues.value.length ? 'warning' : 'primary'
|
|
69
|
+
})
|
|
70
|
+
const contextLocales = computed(() =>
|
|
71
|
+
flat.value.locales
|
|
72
|
+
.filter((code) => code !== baseLocale.value && code !== locale.value)
|
|
73
|
+
.filter((code) => stringValue(props.row.values[code]))
|
|
74
|
+
.slice(0, CONTEXT_LANGUAGES),
|
|
75
|
+
)
|
|
76
|
+
const overrideLink = computed(() =>
|
|
77
|
+
switchLink(DEFAULT_WORKSPACE, {
|
|
78
|
+
page: 'translations',
|
|
79
|
+
query: { key: props.row.key },
|
|
80
|
+
}),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
/** Puts the text in the field, the caret at `caret` (the end by default). */
|
|
84
|
+
async function rewrite(value: string, caret = value.length) {
|
|
85
|
+
draft.value = value
|
|
86
|
+
await nextTick()
|
|
87
|
+
const field = textarea.value?.textareaRef
|
|
88
|
+
field?.focus()
|
|
89
|
+
field?.setSelectionRange(caret, caret)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Writes a variable where the caret is (over the selection). */
|
|
93
|
+
function insertToken(token: string) {
|
|
94
|
+
const text = formatTokens([token])
|
|
95
|
+
const field = textarea.value?.textareaRef
|
|
96
|
+
const start = field?.selectionStart ?? draft.value.length
|
|
97
|
+
const end = field?.selectionEnd ?? draft.value.length
|
|
98
|
+
void rewrite(
|
|
99
|
+
`${draft.value.slice(0, start)}${text}${draft.value.slice(end)}`,
|
|
100
|
+
start + text.length,
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function replaceToken(from: string, to: string) {
|
|
105
|
+
void rewrite(replacePlaceholder(draft.value, from, to))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
defineExpose({
|
|
109
|
+
/** The text field, for the keys that leave it. */
|
|
110
|
+
field: () => textarea.value?.textareaRef,
|
|
111
|
+
focus: () => textarea.value?.textareaRef?.focus(),
|
|
112
|
+
})
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<template>
|
|
116
|
+
<div class="space-y-4 px-4 py-4">
|
|
117
|
+
<div class="flex items-center gap-2">
|
|
118
|
+
<UIcon name="i-ph-key" class="text-dimmed size-4" />
|
|
119
|
+
<span class="break-all font-mono text-xs">
|
|
120
|
+
<span class="text-dimmed">{{ keyParts.path }}</span>
|
|
121
|
+
<span class="text-primary font-semibold">{{ keyParts.leaf }}</span>
|
|
122
|
+
</span>
|
|
123
|
+
<DmsStatusPill
|
|
124
|
+
v-if="session.currentStatus.value"
|
|
125
|
+
dot="none"
|
|
126
|
+
size="sm"
|
|
127
|
+
:tone="session.currentStatus.value === 'done' ? 'success' : 'neutral'"
|
|
128
|
+
:label="$t(`dms_lang.queue.status_${session.currentStatus.value}`)"
|
|
129
|
+
/>
|
|
130
|
+
<DmsStatusPill
|
|
131
|
+
v-if="drafts.has(props.row.key)"
|
|
132
|
+
dot="none"
|
|
133
|
+
size="sm"
|
|
134
|
+
tone="warning"
|
|
135
|
+
:label="$t('dms_lang.queue.draft')"
|
|
136
|
+
/>
|
|
137
|
+
<DmsStatusPill
|
|
138
|
+
v-else-if="isOutdated"
|
|
139
|
+
dot="none"
|
|
140
|
+
size="sm"
|
|
141
|
+
tone="warning"
|
|
142
|
+
:label="$t('dms_lang.queue.status_outdated')"
|
|
143
|
+
/>
|
|
144
|
+
<DmsStatusPill
|
|
145
|
+
v-if="baseText.length > LONG_TEXT"
|
|
146
|
+
dot="none"
|
|
147
|
+
tone="neutral"
|
|
148
|
+
size="sm"
|
|
149
|
+
class="ml-auto"
|
|
150
|
+
:label="$t('dms_lang.queue.long_text')"
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div class="space-y-1.5">
|
|
155
|
+
<div class="flex items-center gap-2 text-sm">
|
|
156
|
+
<LocaleTile :code="baseLocale" size="sm" is-base />
|
|
157
|
+
<span class="text-highlighted font-medium">
|
|
158
|
+
{{ nameOf(baseLocale) }}
|
|
159
|
+
</span>
|
|
160
|
+
<span class="text-dimmed text-xs">
|
|
161
|
+
{{ $t('dms_lang.common.base') }}
|
|
162
|
+
</span>
|
|
163
|
+
</div>
|
|
164
|
+
<div
|
|
165
|
+
class="border-default bg-(--dms-bg-muted) rounded-md border px-3.5 py-3 text-base"
|
|
166
|
+
:dir="textDirection(baseLocale)"
|
|
167
|
+
>
|
|
168
|
+
<PlaceholderText
|
|
169
|
+
v-if="baseText"
|
|
170
|
+
:text="baseText"
|
|
171
|
+
class="text-highlighted"
|
|
172
|
+
/>
|
|
173
|
+
<span v-else class="text-dimmed italic">
|
|
174
|
+
{{ $t('dms_lang.queue.no_base') }}
|
|
175
|
+
</span>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<div v-if="contextLocales.length" class="space-y-1">
|
|
180
|
+
<DmsEyebrow :label="$t('dms_lang.queue.context')" size="xs" />
|
|
181
|
+
<p
|
|
182
|
+
v-for="code in contextLocales"
|
|
183
|
+
:key="code"
|
|
184
|
+
class="text-muted flex items-start gap-2 text-sm"
|
|
185
|
+
>
|
|
186
|
+
<LocaleTile :code="code" size="sm" />
|
|
187
|
+
<span :dir="textDirection(code)">
|
|
188
|
+
{{ stringValue(props.row.values[code]) }}
|
|
189
|
+
</span>
|
|
190
|
+
</p>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div class="space-y-1.5">
|
|
194
|
+
<div class="flex items-center gap-2 text-sm">
|
|
195
|
+
<LocaleTile :code="locale" size="sm" />
|
|
196
|
+
<span class="text-highlighted font-medium">{{ languageName }}</span>
|
|
197
|
+
<span class="text-dimmed font-mono text-xs">{{ locale }}</span>
|
|
198
|
+
<span
|
|
199
|
+
v-if="tokens.length && !issues.length"
|
|
200
|
+
class="ml-auto inline-flex items-center gap-1 text-xs"
|
|
201
|
+
:class="draft ? 'text-success' : 'text-dimmed'"
|
|
202
|
+
>
|
|
203
|
+
<UIcon
|
|
204
|
+
:name="draft ? 'i-ph-check' : 'i-ph-brackets-curly'"
|
|
205
|
+
class="size-3.5"
|
|
206
|
+
/>
|
|
207
|
+
{{
|
|
208
|
+
$t(draft ? 'dms_lang.queue.uses' : 'dms_lang.queue.needs', {
|
|
209
|
+
tokens: formatTokens(tokens),
|
|
210
|
+
})
|
|
211
|
+
}}
|
|
212
|
+
</span>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<DmsBanner
|
|
216
|
+
v-if="conflict !== undefined"
|
|
217
|
+
tone="warning"
|
|
218
|
+
icon="i-ph-warning"
|
|
219
|
+
:title="$t('dms_lang.queue.conflict_title', { key: props.row.key })"
|
|
220
|
+
:description="
|
|
221
|
+
conflict
|
|
222
|
+
? $t('dms_lang.queue.conflict_current', { value: conflict })
|
|
223
|
+
: $t('dms_lang.queue.conflict_empty')
|
|
224
|
+
"
|
|
225
|
+
>
|
|
226
|
+
<template #actions>
|
|
227
|
+
<UButton
|
|
228
|
+
:label="$t('dms_lang.queue.conflict_use')"
|
|
229
|
+
color="warning"
|
|
230
|
+
variant="outline"
|
|
231
|
+
size="xs"
|
|
232
|
+
@click="save.useTheirs"
|
|
233
|
+
/>
|
|
234
|
+
<UButton
|
|
235
|
+
:label="$t('dms_lang.queue.conflict_overwrite')"
|
|
236
|
+
color="warning"
|
|
237
|
+
size="xs"
|
|
238
|
+
:disabled="isSaving"
|
|
239
|
+
@click="save.overwrite"
|
|
240
|
+
/>
|
|
241
|
+
</template>
|
|
242
|
+
</DmsBanner>
|
|
243
|
+
|
|
244
|
+
<DmsBanner
|
|
245
|
+
v-if="isOutdated && canEditValues && !drafts.has(props.row.key)"
|
|
246
|
+
tone="warning"
|
|
247
|
+
size="sm"
|
|
248
|
+
icon="i-ph-clock-counter-clockwise"
|
|
249
|
+
:description="$t('dms_lang.drawer.outdated')"
|
|
250
|
+
>
|
|
251
|
+
<template #actions>
|
|
252
|
+
<UButton
|
|
253
|
+
:label="$t('dms_lang.drawer.mark_reviewed')"
|
|
254
|
+
icon="i-ph-check"
|
|
255
|
+
color="warning"
|
|
256
|
+
variant="outline"
|
|
257
|
+
size="xs"
|
|
258
|
+
:loading="isReviewing"
|
|
259
|
+
@click="save.markReviewed"
|
|
260
|
+
/>
|
|
261
|
+
</template>
|
|
262
|
+
</DmsBanner>
|
|
263
|
+
|
|
264
|
+
<DmsBanner
|
|
265
|
+
v-if="!canEditValues"
|
|
266
|
+
tone="info"
|
|
267
|
+
size="sm"
|
|
268
|
+
icon="i-ph-lock-simple"
|
|
269
|
+
:description="
|
|
270
|
+
isModules
|
|
271
|
+
? $t('dms_lang.queue.read_only_modules')
|
|
272
|
+
: $t('dms_lang.queue.read_only')
|
|
273
|
+
"
|
|
274
|
+
>
|
|
275
|
+
<template v-if="isModules" #actions>
|
|
276
|
+
<UButton
|
|
277
|
+
:label="$t('dms_lang.queue.override')"
|
|
278
|
+
icon="i-ph-pencil-simple"
|
|
279
|
+
color="neutral"
|
|
280
|
+
variant="outline"
|
|
281
|
+
size="xs"
|
|
282
|
+
:to="overrideLink"
|
|
283
|
+
/>
|
|
284
|
+
</template>
|
|
285
|
+
</DmsBanner>
|
|
286
|
+
|
|
287
|
+
<UTextarea
|
|
288
|
+
ref="textarea"
|
|
289
|
+
v-model="draft"
|
|
290
|
+
:rows="3"
|
|
291
|
+
autoresize
|
|
292
|
+
:maxrows="12"
|
|
293
|
+
autofocus
|
|
294
|
+
class="w-full"
|
|
295
|
+
:disabled="!canEditValues"
|
|
296
|
+
:color="fieldColor"
|
|
297
|
+
:highlight="true"
|
|
298
|
+
:placeholder="baseText"
|
|
299
|
+
:dir="textDirection(locale)"
|
|
300
|
+
:ui="{ base: 'text-base' }"
|
|
301
|
+
/>
|
|
302
|
+
|
|
303
|
+
<ul v-if="issues.length" class="space-y-0.5 text-xs">
|
|
304
|
+
<li
|
|
305
|
+
v-for="issue in issues"
|
|
306
|
+
:key="issue.kind"
|
|
307
|
+
class="inline-flex w-full items-center gap-1"
|
|
308
|
+
:class="issue.severity === 'error' ? 'text-error' : 'text-warning'"
|
|
309
|
+
>
|
|
310
|
+
<UIcon name="i-ph-warning" class="size-3.5 shrink-0" />
|
|
311
|
+
{{ messageIssueText(issue, t) }}
|
|
312
|
+
</li>
|
|
313
|
+
</ul>
|
|
314
|
+
|
|
315
|
+
<ul v-if="rejectedProblems.length" class="text-error space-y-0.5 text-xs">
|
|
316
|
+
<li
|
|
317
|
+
v-for="problem in rejectedProblems"
|
|
318
|
+
:key="problem"
|
|
319
|
+
class="inline-flex w-full items-center gap-1"
|
|
320
|
+
>
|
|
321
|
+
<UIcon name="i-ph-x-circle" class="size-3.5 shrink-0" />
|
|
322
|
+
{{ problem }}
|
|
323
|
+
</li>
|
|
324
|
+
</ul>
|
|
325
|
+
|
|
326
|
+
<div
|
|
327
|
+
v-if="canEditValues && (missingTokens.length || isBlocked)"
|
|
328
|
+
class="flex flex-wrap gap-1.5"
|
|
329
|
+
>
|
|
330
|
+
<UButton
|
|
331
|
+
v-if="replacement"
|
|
332
|
+
size="xs"
|
|
333
|
+
color="warning"
|
|
334
|
+
variant="soft"
|
|
335
|
+
icon="i-ph-swap"
|
|
336
|
+
:label="
|
|
337
|
+
$t('dms_lang.queue.replace', {
|
|
338
|
+
from: formatTokens([replacement.from]),
|
|
339
|
+
to: formatTokens([replacement.to]),
|
|
340
|
+
})
|
|
341
|
+
"
|
|
342
|
+
@mousedown.prevent
|
|
343
|
+
@click="replaceToken(replacement.from, replacement.to)"
|
|
344
|
+
/>
|
|
345
|
+
<UButton
|
|
346
|
+
v-for="token in missingTokens"
|
|
347
|
+
:key="token"
|
|
348
|
+
size="xs"
|
|
349
|
+
color="warning"
|
|
350
|
+
variant="soft"
|
|
351
|
+
:label="
|
|
352
|
+
$t('dms_lang.drawer.insert', { token: formatTokens([token]) })
|
|
353
|
+
"
|
|
354
|
+
@mousedown.prevent
|
|
355
|
+
@click="insertToken(token)"
|
|
356
|
+
/>
|
|
357
|
+
<UButton
|
|
358
|
+
v-if="isBlocked && escapedDraft !== draft"
|
|
359
|
+
size="xs"
|
|
360
|
+
color="error"
|
|
361
|
+
variant="soft"
|
|
362
|
+
icon="i-ph-magic-wand"
|
|
363
|
+
:label="$t('dms_lang.queue.escape')"
|
|
364
|
+
@mousedown.prevent
|
|
365
|
+
@click="rewrite(escapedDraft)"
|
|
366
|
+
/>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<p v-if="isArmed && !isBlocked" class="text-warning text-xs font-medium">
|
|
370
|
+
{{ $t('dms_lang.queue.save_anyway_hint') }}
|
|
371
|
+
</p>
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
</template>
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DropdownMenuItem } from '@nuxt/ui'
|
|
3
|
+
import { QUEUE_MODES } from '../../../composables/translation/useLanguageQueue'
|
|
4
|
+
import type { DraftGroup } from '../../../utils/queueDrafts'
|
|
5
|
+
import LocaleTile from '../LocaleTile.vue'
|
|
6
|
+
import { useQueue } from '../../composables/useQueueContext'
|
|
7
|
+
|
|
8
|
+
const SELECTED_ICON = 'i-ph-check'
|
|
9
|
+
|
|
10
|
+
const { t } = useI18n()
|
|
11
|
+
const { formatCount } = useLangFormat()
|
|
12
|
+
const { selectedWorkspace } = useI18nWorkspaces()
|
|
13
|
+
const { flat } = useWorkspaceFlat()
|
|
14
|
+
const { switchLink } = useWorkspaceRoute()
|
|
15
|
+
const { fullName, nativeName } = useLocaleNames()
|
|
16
|
+
const links = useLangLinks()
|
|
17
|
+
const { session, languageName, nameOf } = useQueue()
|
|
18
|
+
const { locale, baseLocale, mode, namespace, counts, drafts } = session
|
|
19
|
+
|
|
20
|
+
const modeItems = computed(() =>
|
|
21
|
+
QUEUE_MODES.map((value) => ({
|
|
22
|
+
label: t(`dms_lang.queue.mode_${value}`, {
|
|
23
|
+
count: formatCount(counts.value[value]),
|
|
24
|
+
}),
|
|
25
|
+
value,
|
|
26
|
+
})),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
function countLabel(key: string, count: number): string {
|
|
30
|
+
return t(key, { n: formatCount(count) }, count)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const remainingLabel = computed(() => {
|
|
34
|
+
const remaining = countLabel(
|
|
35
|
+
'dms_lang.queue.remaining',
|
|
36
|
+
session.pending.value.length,
|
|
37
|
+
)
|
|
38
|
+
const skipped = session.skippedCount.value
|
|
39
|
+
if (!skipped) return remaining
|
|
40
|
+
return `${remaining} · ${countLabel('dms_lang.queue.skipped_count', skipped)}`
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
function draftCountOf(code: string): number {
|
|
44
|
+
const group = drafts.groups.value.find(
|
|
45
|
+
(entry) =>
|
|
46
|
+
entry.workspace === selectedWorkspace.value && entry.locale === code,
|
|
47
|
+
)
|
|
48
|
+
return group?.count ?? 0
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function languageStatus(code: string): string {
|
|
52
|
+
if (code === baseLocale.value) return t('dms_lang.common.base')
|
|
53
|
+
const missing = flat.value.localeMissing[code] ?? 0
|
|
54
|
+
const status = countLabel('dms_lang.queue.language_missing', missing)
|
|
55
|
+
const count = draftCountOf(code)
|
|
56
|
+
if (!count) return status
|
|
57
|
+
return `${status} · ${countLabel('dms_lang.queue.drafts_count', count)}`
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const languageItems = computed<DropdownMenuItem[][]>(() => [
|
|
61
|
+
[
|
|
62
|
+
{ type: 'label', label: t('dms_lang.queue.switch_language') },
|
|
63
|
+
...flat.value.locales.map((code) => ({
|
|
64
|
+
label: `${fullName(code)} · ${code}`,
|
|
65
|
+
description: languageStatus(code),
|
|
66
|
+
trailingIcon: code === locale.value ? SELECTED_ICON : undefined,
|
|
67
|
+
to: links.language(code),
|
|
68
|
+
})),
|
|
69
|
+
],
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
function draftLink(group: DraftGroup) {
|
|
73
|
+
const sameWorkspace = group.workspace === selectedWorkspace.value
|
|
74
|
+
const where = sameWorkspace
|
|
75
|
+
? nameOf(group.locale)
|
|
76
|
+
: `${group.workspace} · ${nativeName(group.locale)}`
|
|
77
|
+
return {
|
|
78
|
+
id: `${group.workspace}:${group.locale}`,
|
|
79
|
+
label: `${where} (${formatCount(group.count)})`,
|
|
80
|
+
to: sameWorkspace
|
|
81
|
+
? links.language(group.locale)
|
|
82
|
+
: switchLink(group.workspace, {
|
|
83
|
+
page: 'language',
|
|
84
|
+
query: { locale: group.locale },
|
|
85
|
+
}),
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Links back to the drafts left in other languages and workspaces. */
|
|
90
|
+
const draftLinks = computed(() => drafts.elsewhere.value.map(draftLink))
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<div class="border-default space-y-3 border-b px-4 py-3">
|
|
95
|
+
<div class="flex flex-wrap items-center gap-x-3 gap-y-2">
|
|
96
|
+
<LocaleTile :code="locale" :siblings="flat.locales" />
|
|
97
|
+
<div class="grid min-w-0 gap-px">
|
|
98
|
+
<DmsEyebrow :label="$t('dms_lang.queue.title')" size="xs" />
|
|
99
|
+
<span class="text-highlighted truncate text-base font-semibold">
|
|
100
|
+
{{ languageName }}
|
|
101
|
+
<span class="text-dimmed font-mono text-xs font-normal">
|
|
102
|
+
{{ locale }}
|
|
103
|
+
</span>
|
|
104
|
+
</span>
|
|
105
|
+
</div>
|
|
106
|
+
<UDropdownMenu
|
|
107
|
+
:items="languageItems"
|
|
108
|
+
:content="{ align: 'start' }"
|
|
109
|
+
:ui="{ content: 'w-72' }"
|
|
110
|
+
>
|
|
111
|
+
<UButton
|
|
112
|
+
icon="i-ph-caret-up-down"
|
|
113
|
+
color="neutral"
|
|
114
|
+
variant="ghost"
|
|
115
|
+
size="xs"
|
|
116
|
+
:aria-label="$t('dms_lang.queue.switch_language')"
|
|
117
|
+
/>
|
|
118
|
+
</UDropdownMenu>
|
|
119
|
+
<span class="text-muted ml-auto font-mono text-xs">
|
|
120
|
+
{{ remainingLabel }}
|
|
121
|
+
</span>
|
|
122
|
+
</div>
|
|
123
|
+
<div
|
|
124
|
+
v-if="draftLinks.length"
|
|
125
|
+
class="text-muted flex flex-wrap items-center gap-1.5 text-xs"
|
|
126
|
+
>
|
|
127
|
+
<UIcon name="i-ph-note-pencil" class="text-warning size-3.5" />
|
|
128
|
+
<span>{{ $t('dms_lang.queue.drafts_elsewhere') }}</span>
|
|
129
|
+
<UButton
|
|
130
|
+
v-for="entry in draftLinks"
|
|
131
|
+
:key="entry.id"
|
|
132
|
+
size="xs"
|
|
133
|
+
color="warning"
|
|
134
|
+
variant="soft"
|
|
135
|
+
:label="entry.label"
|
|
136
|
+
:to="entry.to"
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
140
|
+
<DmsMeter
|
|
141
|
+
class="min-w-24 flex-1"
|
|
142
|
+
:value="session.progress.value"
|
|
143
|
+
:max="100"
|
|
144
|
+
format="none"
|
|
145
|
+
size="xs"
|
|
146
|
+
tone="primary"
|
|
147
|
+
/>
|
|
148
|
+
<UButton
|
|
149
|
+
v-if="namespace"
|
|
150
|
+
size="xs"
|
|
151
|
+
color="primary"
|
|
152
|
+
variant="soft"
|
|
153
|
+
trailing-icon="i-ph-x"
|
|
154
|
+
class="font-mono"
|
|
155
|
+
:label="namespace"
|
|
156
|
+
:aria-label="$t('dms_lang.queue.scope_clear', { namespace })"
|
|
157
|
+
@click="namespace = ''"
|
|
158
|
+
/>
|
|
159
|
+
<DmsSegmented v-model="mode" :items="modeItems" size="xs" />
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</template>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { stringValue } from '../../../utils/translations'
|
|
3
|
+
import { useQueue } from '../../composables/useQueueContext'
|
|
4
|
+
|
|
5
|
+
const { session } = useQueue()
|
|
6
|
+
const { upNext, drafts, baseLocale } = session
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<ul
|
|
11
|
+
v-if="upNext.length"
|
|
12
|
+
class="border-default divide-default divide-y border-t"
|
|
13
|
+
>
|
|
14
|
+
<li
|
|
15
|
+
v-for="(entry, offset) in upNext"
|
|
16
|
+
:key="entry.row.key"
|
|
17
|
+
class="grid grid-cols-[4rem_minmax(0,16rem)_minmax(0,1fr)] items-center gap-3 px-4 py-2"
|
|
18
|
+
>
|
|
19
|
+
<DmsEyebrow
|
|
20
|
+
v-if="offset === 0"
|
|
21
|
+
:label="$t('dms_lang.queue.up_next')"
|
|
22
|
+
size="xs"
|
|
23
|
+
/>
|
|
24
|
+
<span v-else />
|
|
25
|
+
<button
|
|
26
|
+
type="button"
|
|
27
|
+
class="hover:text-primary flex min-w-0 items-center gap-1.5 text-left font-mono text-xs"
|
|
28
|
+
@click="session.goTo(entry.index)"
|
|
29
|
+
>
|
|
30
|
+
<span class="truncate">{{ entry.row.key }}</span>
|
|
31
|
+
<DmsStatusPill
|
|
32
|
+
v-if="drafts.has(entry.row.key)"
|
|
33
|
+
dot="none"
|
|
34
|
+
size="sm"
|
|
35
|
+
tone="warning"
|
|
36
|
+
:label="$t('dms_lang.queue.draft')"
|
|
37
|
+
/>
|
|
38
|
+
<DmsStatusPill
|
|
39
|
+
v-else-if="entry.isSkipped"
|
|
40
|
+
dot="none"
|
|
41
|
+
size="sm"
|
|
42
|
+
tone="neutral"
|
|
43
|
+
:label="$t('dms_lang.queue.status_skipped')"
|
|
44
|
+
/>
|
|
45
|
+
<DmsStatusPill
|
|
46
|
+
v-else-if="session.isOutdated(entry.row)"
|
|
47
|
+
dot="none"
|
|
48
|
+
size="sm"
|
|
49
|
+
tone="warning"
|
|
50
|
+
:label="$t('dms_lang.queue.status_outdated')"
|
|
51
|
+
/>
|
|
52
|
+
</button>
|
|
53
|
+
<span class="text-muted truncate text-sm">
|
|
54
|
+
{{ stringValue(entry.row.values[baseLocale]) }}
|
|
55
|
+
</span>
|
|
56
|
+
</li>
|
|
57
|
+
<li class="text-dimmed px-4 py-1.5 text-xs">
|
|
58
|
+
{{ $t('dms_lang.queue.order') }}
|
|
59
|
+
</li>
|
|
60
|
+
</ul>
|
|
61
|
+
</template>
|