@antelopejs/dms-lang 0.0.7 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/README.md +12 -6
  2. package/dist/pages/actions.d.ts +7 -0
  3. package/dist/pages/actions.js +15 -0
  4. package/dist/pages/actions.js.map +1 -0
  5. package/dist/pages/component-action.d.ts +2 -0
  6. package/dist/pages/component-action.js +10 -0
  7. package/dist/pages/component-action.js.map +1 -0
  8. package/dist/pages/header-actions.d.ts +9 -0
  9. package/dist/pages/header-actions.js +146 -0
  10. package/dist/pages/header-actions.js.map +1 -0
  11. package/dist/pages/index.d.ts +6 -0
  12. package/dist/pages/index.js +6 -0
  13. package/dist/pages/index.js.map +1 -1
  14. package/dist/pages/language.d.ts +10 -0
  15. package/dist/pages/language.js +89 -0
  16. package/dist/pages/language.js.map +1 -0
  17. package/dist/pages/languages-table.d.ts +2 -0
  18. package/dist/pages/languages-table.js +120 -0
  19. package/dist/pages/languages-table.js.map +1 -0
  20. package/dist/pages/module.d.ts +7 -1
  21. package/dist/pages/module.js +28 -2
  22. package/dist/pages/module.js.map +1 -1
  23. package/dist/pages/overview.d.ts +2 -1
  24. package/dist/pages/overview.js +83 -8
  25. package/dist/pages/overview.js.map +1 -1
  26. package/dist/pages/page-actions.d.ts +6 -0
  27. package/dist/pages/page-actions.js +10 -0
  28. package/dist/pages/page-actions.js.map +1 -0
  29. package/dist/pages/quick-actions.d.ts +1 -0
  30. package/dist/pages/quick-actions.js +56 -0
  31. package/dist/pages/quick-actions.js.map +1 -0
  32. package/dist/pages/translations.d.ts +7 -1
  33. package/dist/pages/translations.js +47 -10
  34. package/dist/pages/translations.js.map +1 -1
  35. package/dist/pages/workspace-guard.d.ts +1 -0
  36. package/dist/pages/workspace-guard.js +35 -0
  37. package/dist/pages/workspace-guard.js.map +1 -0
  38. package/dist/pages/workspace.d.ts +18 -0
  39. package/dist/pages/workspace.js +162 -0
  40. package/dist/pages/workspace.js.map +1 -0
  41. package/dist/pages/workspaces.d.ts +14 -0
  42. package/dist/pages/workspaces.js +88 -0
  43. package/dist/pages/workspaces.js.map +1 -0
  44. package/dist/routes/publicLocales.d.ts +3 -2
  45. package/dist/routes/publicLocales.js +39 -18
  46. package/dist/routes/publicLocales.js.map +1 -1
  47. package/dist/routes/translations.d.ts +59 -63
  48. package/dist/routes/translations.js +400 -119
  49. package/dist/routes/translations.js.map +1 -1
  50. package/dist/utils/announce.d.ts +9 -0
  51. package/dist/utils/announce.js +29 -0
  52. package/dist/utils/announce.js.map +1 -0
  53. package/dist/utils/blocks.d.ts +8 -0
  54. package/dist/utils/blocks.js +213 -0
  55. package/dist/utils/blocks.js.map +1 -0
  56. package/dist/utils/body.d.ts +1 -0
  57. package/dist/utils/body.js +21 -0
  58. package/dist/utils/body.js.map +1 -0
  59. package/dist/utils/cache.d.ts +3 -0
  60. package/dist/utils/cache.js +32 -0
  61. package/dist/utils/cache.js.map +1 -0
  62. package/dist/utils/catalog.d.ts +7 -0
  63. package/dist/utils/catalog.js +62 -0
  64. package/dist/utils/catalog.js.map +1 -0
  65. package/dist/utils/constants.d.ts +6 -0
  66. package/dist/utils/constants.js +10 -0
  67. package/dist/utils/constants.js.map +1 -0
  68. package/dist/utils/coverage.d.ts +2 -0
  69. package/dist/utils/coverage.js +11 -0
  70. package/dist/utils/coverage.js.map +1 -0
  71. package/dist/utils/dialogs.d.ts +7 -0
  72. package/dist/utils/dialogs.js +103 -0
  73. package/dist/utils/dialogs.js.map +1 -0
  74. package/dist/utils/errors.d.ts +40 -0
  75. package/dist/utils/errors.js +60 -0
  76. package/dist/utils/errors.js.map +1 -0
  77. package/dist/utils/export.d.ts +17 -0
  78. package/dist/utils/export.js +129 -0
  79. package/dist/utils/export.js.map +1 -0
  80. package/dist/utils/json.d.ts +10 -1
  81. package/dist/utils/json.js +127 -19
  82. package/dist/utils/json.js.map +1 -1
  83. package/dist/utils/key-stores.d.ts +3 -0
  84. package/dist/utils/key-stores.js +24 -0
  85. package/dist/utils/key-stores.js.map +1 -0
  86. package/dist/utils/keys.d.ts +23 -0
  87. package/dist/utils/keys.js +252 -0
  88. package/dist/utils/keys.js.map +1 -0
  89. package/dist/utils/languages.d.ts +27 -0
  90. package/dist/utils/languages.js +121 -0
  91. package/dist/utils/languages.js.map +1 -0
  92. package/dist/utils/locale-codes.d.ts +5 -0
  93. package/dist/utils/locale-codes.js +56 -0
  94. package/dist/utils/locale-codes.js.map +1 -0
  95. package/dist/utils/locale-discovery.d.ts +1 -0
  96. package/dist/utils/locale-discovery.js +19 -1
  97. package/dist/utils/locale-discovery.js.map +1 -1
  98. package/dist/utils/message-check.d.ts +1 -0
  99. package/dist/utils/message-check.js +93 -0
  100. package/dist/utils/message-check.js.map +1 -0
  101. package/dist/utils/message-syntax.d.ts +6 -0
  102. package/dist/utils/message-syntax.js +38 -0
  103. package/dist/utils/message-syntax.js.map +1 -0
  104. package/dist/utils/namespaces.d.ts +12 -0
  105. package/dist/utils/namespaces.js +52 -0
  106. package/dist/utils/namespaces.js.map +1 -0
  107. package/dist/utils/notices.d.ts +4 -0
  108. package/dist/utils/notices.js +60 -0
  109. package/dist/utils/notices.js.map +1 -0
  110. package/dist/utils/own.d.ts +2 -3
  111. package/dist/utils/own.js +17 -57
  112. package/dist/utils/own.js.map +1 -1
  113. package/dist/utils/public-url.d.ts +8 -0
  114. package/dist/utils/public-url.js +87 -0
  115. package/dist/utils/public-url.js.map +1 -0
  116. package/dist/utils/registry.d.ts +3 -1
  117. package/dist/utils/registry.js +26 -10
  118. package/dist/utils/registry.js.map +1 -1
  119. package/dist/utils/resolve.d.ts +18 -15
  120. package/dist/utils/resolve.js +98 -151
  121. package/dist/utils/resolve.js.map +1 -1
  122. package/dist/utils/review.d.ts +5 -0
  123. package/dist/utils/review.js +64 -0
  124. package/dist/utils/review.js.map +1 -0
  125. package/dist/utils/snippets.d.ts +7 -0
  126. package/dist/utils/snippets.js +129 -0
  127. package/dist/utils/snippets.js.map +1 -0
  128. package/dist/utils/summary.d.ts +23 -0
  129. package/dist/utils/summary.js +65 -0
  130. package/dist/utils/summary.js.map +1 -0
  131. package/dist/utils/tree.d.ts +2 -17
  132. package/dist/utils/tree.js +21 -126
  133. package/dist/utils/tree.js.map +1 -1
  134. package/dist/utils/workspaces.d.ts +45 -15
  135. package/dist/utils/workspaces.js +256 -164
  136. package/dist/utils/workspaces.js.map +1 -1
  137. package/dist/validation/key.schema.d.ts +71 -0
  138. package/dist/validation/key.schema.js +67 -0
  139. package/dist/validation/key.schema.js.map +1 -0
  140. package/dist/validation/query.schema.d.ts +17 -0
  141. package/dist/validation/query.schema.js +44 -0
  142. package/dist/validation/query.schema.js.map +1 -0
  143. package/dist/validation/validate.d.ts +2 -0
  144. package/dist/validation/validate.js +24 -0
  145. package/dist/validation/validate.js.map +1 -0
  146. package/dist/validation/workspace.schema.d.ts +145 -0
  147. package/dist/validation/workspace.schema.js +83 -0
  148. package/dist/validation/workspace.schema.js.map +1 -0
  149. package/frontend-vue/app/build/components/KeyAddModal.vue +340 -0
  150. package/frontend-vue/app/build/components/KeyEditorDrawer.vue +951 -0
  151. package/frontend-vue/app/build/components/KeyRenameModal.vue +172 -0
  152. package/frontend-vue/app/build/components/LanguageAddModal.vue +199 -0
  153. package/frontend-vue/app/build/components/LanguagePicker.vue +233 -0
  154. package/frontend-vue/app/build/components/LocaleTile.vue +52 -0
  155. package/frontend-vue/app/build/components/PlaceholderText.vue +42 -0
  156. package/frontend-vue/app/build/components/ShortcutKbds.vue +22 -0
  157. package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +193 -0
  158. package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +107 -0
  159. package/frontend-vue/app/build/components/form/FormFieldRow.vue +70 -0
  160. package/frontend-vue/app/build/components/form/FormRows.vue +25 -0
  161. package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +44 -0
  162. package/frontend-vue/app/build/components/matrix/MatrixCell.vue +488 -0
  163. package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +177 -0
  164. package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +57 -0
  165. package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +83 -0
  166. package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +167 -0
  167. package/frontend-vue/app/build/components/queue/QueueActions.vue +60 -0
  168. package/frontend-vue/app/build/components/queue/QueueDone.vue +185 -0
  169. package/frontend-vue/app/build/components/queue/QueueEditor.vue +374 -0
  170. package/frontend-vue/app/build/components/queue/QueueHeader.vue +162 -0
  171. package/frontend-vue/app/build/components/queue/QueueUpNext.vue +61 -0
  172. package/frontend-vue/app/build/composables/useCellEditor.ts +324 -0
  173. package/frontend-vue/app/build/composables/useCellMoves.ts +155 -0
  174. package/frontend-vue/app/build/composables/useCellSaves.ts +339 -0
  175. package/frontend-vue/app/build/composables/useKeyPanel.ts +284 -0
  176. package/frontend-vue/app/build/composables/useKeySaves.ts +280 -0
  177. package/frontend-vue/app/build/composables/useMatrixFilters.ts +213 -0
  178. package/frontend-vue/app/build/composables/useMatrixRows.ts +104 -0
  179. package/frontend-vue/app/build/composables/useMatrixView.ts +181 -0
  180. package/frontend-vue/app/build/composables/useQueueContext.ts +31 -0
  181. package/frontend-vue/app/build/composables/useQueueEditing.ts +53 -0
  182. package/frontend-vue/app/build/composables/useQueueOrphans.ts +54 -0
  183. package/frontend-vue/app/build/composables/useQueueSave.ts +290 -0
  184. package/frontend-vue/app/build/composables/useQueueShortcuts.ts +106 -0
  185. package/frontend-vue/app/build/composables/useQueueToasts.ts +99 -0
  186. package/frontend-vue/app/components/LanguageNamespaces.vue +77 -0
  187. package/frontend-vue/app/components/NamespaceCoverage.vue +222 -0
  188. package/frontend-vue/app/components/TranslationMatrix.vue +809 -0
  189. package/frontend-vue/app/components/TranslationQueue.vue +212 -0
  190. package/frontend-vue/app/components/WorkspaceDangerZone.vue +81 -0
  191. package/frontend-vue/app/components/WorkspaceGeneral.vue +232 -0
  192. package/frontend-vue/app/components/WorkspaceList.vue +454 -0
  193. package/frontend-vue/app/components/WorkspaceScope.vue +384 -0
  194. package/frontend-vue/app/composables/translation/useFirstRun.ts +8 -0
  195. package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +221 -133
  196. package/frontend-vue/app/composables/translation/useKeyActions.ts +224 -0
  197. package/frontend-vue/app/composables/translation/useLangFormat.ts +10 -0
  198. package/frontend-vue/app/composables/translation/useLangLinks.ts +80 -0
  199. package/frontend-vue/app/composables/translation/useLanguageActions.ts +159 -0
  200. package/frontend-vue/app/composables/translation/useLanguageQueue.ts +232 -0
  201. package/frontend-vue/app/composables/translation/useLocaleNames.ts +166 -0
  202. package/frontend-vue/app/composables/translation/useMutationToast.ts +51 -17
  203. package/frontend-vue/app/composables/translation/useQueueDrafts.ts +115 -0
  204. package/frontend-vue/app/composables/translation/useQueueSession.ts +182 -0
  205. package/frontend-vue/app/composables/translation/useServedConfirm.ts +152 -0
  206. package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +259 -0
  207. package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +46 -15
  208. package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +322 -70
  209. package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +55 -0
  210. package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +129 -0
  211. package/frontend-vue/app/config/shortcuts-registry.ts +72 -0
  212. package/frontend-vue/app/types/lang.ts +130 -0
  213. package/frontend-vue/app/utils/boundedCache.ts +22 -0
  214. package/frontend-vue/app/utils/download.ts +16 -0
  215. package/frontend-vue/app/utils/keySaveErrors.ts +61 -0
  216. package/frontend-vue/app/utils/keySaves.ts +108 -0
  217. package/frontend-vue/app/utils/languages.ts +272 -0
  218. package/frontend-vue/app/utils/matrixExport.ts +47 -0
  219. package/frontend-vue/app/utils/queueDrafts.ts +115 -0
  220. package/frontend-vue/app/utils/queuePass.ts +145 -0
  221. package/frontend-vue/app/utils/queueView.ts +22 -0
  222. package/frontend-vue/app/utils/shortcuts.ts +75 -0
  223. package/frontend-vue/app/utils/translations.ts +756 -0
  224. package/frontend-vue/app/utils/workspaceBackup.ts +119 -0
  225. package/frontend-vue/app/utils/workspaces.ts +45 -0
  226. package/frontend-vue/dms.frontend.build.ts +5 -0
  227. package/frontend-vue/dms.frontend.ts +9 -20
  228. package/frontend-vue/i18n/locales/lang-en-GB.json +792 -69
  229. package/frontend-vue/i18n/locales/lang-fr-FR.json +792 -69
  230. package/frontend-vue/package.json +8 -6
  231. package/package.json +11 -8
  232. package/dist/utils/mutations.d.ts +0 -3
  233. package/dist/utils/mutations.js +0 -35
  234. package/dist/utils/mutations.js.map +0 -1
  235. package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +0 -284
  236. package/frontend-vue/app/components/LanguageAddModal.vue +0 -78
  237. package/frontend-vue/app/components/WorkspaceEndpoint.vue +0 -29
  238. package/frontend-vue/app/components/WorkspaceSelector.vue +0 -180
  239. package/frontend-vue/app/components/WorkspaceStatus.vue +0 -24
  240. package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +0 -90
  241. package/frontend-vue/app/composables/translation/useLocaleMeta.ts +0 -18
  242. package/frontend-vue/app/composables/translation/useTranslationProgress.ts +0 -73
  243. package/frontend-vue/app/custom-pages/lang/overview.vue +0 -397
  244. package/frontend-vue/app/custom-pages/lang/translations.vue +0 -498
  245. package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +0 -12
@@ -0,0 +1,57 @@
1
+ <script setup lang="ts">
2
+ interface Props {
3
+ namespace: string
4
+ keys: number
5
+ missing: number
6
+ collapsed: boolean
7
+ }
8
+
9
+ interface Emits {
10
+ toggle: []
11
+ }
12
+
13
+ const props = defineProps<Props>()
14
+ const emit = defineEmits<Emits>()
15
+
16
+ const { formatCount } = useLangFormat()
17
+ </script>
18
+
19
+ <template>
20
+ <button
21
+ type="button"
22
+ class="flex items-center gap-2"
23
+ :aria-expanded="!props.collapsed"
24
+ @click="emit('toggle')"
25
+ >
26
+ <UIcon
27
+ name="i-ph-caret-down"
28
+ class="text-dimmed size-3.5 transition-transform"
29
+ :class="props.collapsed ? '-rotate-90' : undefined"
30
+ />
31
+ <span class="text-highlighted font-mono text-xs font-semibold uppercase">
32
+ {{ props.namespace }}
33
+ </span>
34
+ <span class="text-dimmed font-mono text-[10.5px]">
35
+ {{
36
+ $t(
37
+ 'dms_lang.matrix.group_keys',
38
+ { count: formatCount(props.keys) },
39
+ props.keys,
40
+ )
41
+ }}
42
+ </span>
43
+ <DmsStatusPill
44
+ v-if="props.missing"
45
+ dot="none"
46
+ tone="warning"
47
+ size="sm"
48
+ :label="
49
+ $t(
50
+ 'dms_lang.matrix.group_missing',
51
+ { count: formatCount(props.missing) },
52
+ props.missing,
53
+ )
54
+ "
55
+ />
56
+ </button>
57
+ </template>
@@ -0,0 +1,83 @@
1
+ <script setup lang="ts">
2
+ import { NAMESPACE_SEPARATOR } from '../../../utils/translations'
3
+
4
+ interface Props {
5
+ rowKey: string
6
+ /** Saved during this view and no longer matching the filter. */
7
+ isDone: boolean
8
+ isModules: boolean
9
+ isOverridden: boolean
10
+ canOverride: boolean
11
+ }
12
+
13
+ interface Emits {
14
+ open: []
15
+ override: []
16
+ }
17
+
18
+ const props = defineProps<Props>()
19
+ const emit = defineEmits<Emits>()
20
+
21
+ const split = computed(() => props.rowKey.lastIndexOf(NAMESPACE_SEPARATOR) + 1)
22
+ </script>
23
+
24
+ <template>
25
+ <div class="flex items-start gap-1.5">
26
+ <button
27
+ type="button"
28
+ class="hover:text-primary min-w-0 flex-1 text-left font-mono text-xs break-all"
29
+ :title="$t('dms_lang.matrix.open_key')"
30
+ @click="emit('open')"
31
+ >
32
+ <span class="text-dimmed">{{ props.rowKey.slice(0, split) }}</span>
33
+ <span class="text-primary font-semibold">
34
+ {{ props.rowKey.slice(split) }}
35
+ </span>
36
+ </button>
37
+ <UIcon
38
+ v-if="props.isDone"
39
+ name="i-ph-check-circle-fill"
40
+ class="text-success mt-px size-4 shrink-0"
41
+ :aria-label="$t('dms_lang.matrix.done')"
42
+ />
43
+ <UButton
44
+ icon="i-ph-arrows-out-simple"
45
+ color="neutral"
46
+ variant="ghost"
47
+ size="xs"
48
+ class="-my-1 shrink-0"
49
+ :aria-label="
50
+ $t('dms_lang.matrix.open_panel_named', { key: props.rowKey })
51
+ "
52
+ :title="$t('dms_lang.matrix.open_panel')"
53
+ @click="emit('open')"
54
+ />
55
+ <UButton
56
+ v-if="props.isModules && props.canOverride && !props.isOverridden"
57
+ size="xs"
58
+ color="neutral"
59
+ variant="ghost"
60
+ icon="i-ph-git-fork"
61
+ class="-my-1 shrink-0 opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100"
62
+ :aria-label="$t('dms_lang.matrix.override_named', { key: props.rowKey })"
63
+ :title="$t('dms_lang.override.action')"
64
+ @click="emit('override')"
65
+ />
66
+ </div>
67
+ <div v-if="props.isModules && props.isOverridden">
68
+ <button
69
+ type="button"
70
+ class="mt-1"
71
+ :title="$t('dms_lang.matrix.edit_override')"
72
+ @click="emit('override')"
73
+ >
74
+ <DmsStatusPill
75
+ dot="none"
76
+ tone="success"
77
+ size="sm"
78
+ icon="i-ph-check"
79
+ :label="$t('dms_lang.override.overridden')"
80
+ />
81
+ </button>
82
+ </div>
83
+ </template>
@@ -0,0 +1,167 @@
1
+ <script setup lang="ts">
2
+ import { watchDebounced } from '@vueuse/core'
3
+ import type { TranslationFilter } from '../../../types/lang'
4
+ import type {
5
+ MatrixCounts,
6
+ MatrixFilterState,
7
+ } from '../../composables/useMatrixFilters'
8
+
9
+ interface LanguageItem {
10
+ code: string
11
+ name: string
12
+ }
13
+
14
+ interface Props {
15
+ counts: MatrixCounts
16
+ /** The target languages one can translate into. */
17
+ languages: LanguageItem[]
18
+ namespaces: string[]
19
+ /** How many languages the counts look at. */
20
+ countedLanguages: number
21
+ /** The language shown next to the base when none is chosen (on a phone). */
22
+ shownLanguage: string
23
+ isCompact: boolean
24
+ }
25
+
26
+ const SEARCH_DELAY_MS = 200
27
+ const ANY_LANGUAGE = '*'
28
+ const ALL_NAMESPACES = '*'
29
+ const FILTER_LABELS: Record<TranslationFilter, string> = {
30
+ all: 'dms_lang.matrix.filter_all',
31
+ missing: 'dms_lang.matrix.filter_missing',
32
+ complete: 'dms_lang.matrix.filter_complete',
33
+ issues: 'dms_lang.matrix.filter_issues',
34
+ }
35
+
36
+ const props = defineProps<Props>()
37
+ const filters = defineModel<MatrixFilterState>('filters', { required: true })
38
+
39
+ const { t } = useI18n()
40
+ const { formatCount } = useLangFormat()
41
+
42
+ const searchInput = ref(filters.value.search)
43
+
44
+ const filterItems = computed(() =>
45
+ (Object.keys(FILTER_LABELS) as TranslationFilter[]).map((value) => ({
46
+ value,
47
+ label: t(
48
+ value === 'missing' && props.countedLanguages > 1
49
+ ? 'dms_lang.matrix.filter_incomplete'
50
+ : FILTER_LABELS[value],
51
+ { count: formatCount(props.counts[value]) },
52
+ ),
53
+ })),
54
+ )
55
+ const languageItems = computed(() => [
56
+ ...(props.isCompact
57
+ ? []
58
+ : [{ label: t('dms_lang.matrix.every_language'), value: ANY_LANGUAGE }]),
59
+ ...props.languages.map((entry) => ({
60
+ label: `${entry.name} · ${entry.code}`,
61
+ value: entry.code,
62
+ })),
63
+ ])
64
+ const namespaceItems = computed(() => [
65
+ {
66
+ label: t('dms_lang.matrix.all_namespaces', {
67
+ count: props.namespaces.length,
68
+ }),
69
+ value: ALL_NAMESPACES,
70
+ },
71
+ ...props.namespaces.map((namespace) => ({
72
+ label: namespace,
73
+ value: namespace,
74
+ })),
75
+ ])
76
+
77
+ const filterModel = computed({
78
+ get: () => filters.value.filter,
79
+ set: (filter: TranslationFilter) =>
80
+ (filters.value = { ...filters.value, filter }),
81
+ })
82
+ const languageModel = computed({
83
+ get: () => filters.value.missingIn || props.shownLanguage || ANY_LANGUAGE,
84
+ set: (value: string) => {
85
+ const missingIn = value === ANY_LANGUAGE ? '' : value
86
+ filters.value = {
87
+ ...filters.value,
88
+ missingIn,
89
+ filter: missingIn ? 'missing' : filters.value.filter,
90
+ }
91
+ },
92
+ })
93
+ const namespaceModel = computed({
94
+ get: () => filters.value.namespace || ALL_NAMESPACES,
95
+ set: (value: string) =>
96
+ (filters.value = {
97
+ ...filters.value,
98
+ namespace: value === ALL_NAMESPACES ? '' : value,
99
+ }),
100
+ })
101
+
102
+ watch(
103
+ () => filters.value.search,
104
+ (search) => {
105
+ if (search !== searchInput.value.trim()) searchInput.value = search
106
+ },
107
+ )
108
+
109
+ watchDebounced(
110
+ searchInput,
111
+ (value) => {
112
+ if (value !== filters.value.search)
113
+ filters.value = { ...filters.value, search: value }
114
+ },
115
+ { debounce: SEARCH_DELAY_MS },
116
+ )
117
+ </script>
118
+
119
+ <template>
120
+ <div
121
+ class="border-default gap-2 border-b p-3"
122
+ :class="
123
+ props.isCompact ? 'grid grid-cols-1' : 'flex flex-wrap items-center'
124
+ "
125
+ >
126
+ <USelect
127
+ v-if="props.isCompact"
128
+ v-model="filterModel"
129
+ :items="filterItems"
130
+ size="sm"
131
+ class="w-full"
132
+ :aria-label="$t('dms_lang.matrix.filter_label')"
133
+ />
134
+ <DmsSegmented
135
+ v-else
136
+ v-model="filterModel"
137
+ :items="filterItems"
138
+ size="sm"
139
+ :aria-label="$t('dms_lang.matrix.filter_label')"
140
+ />
141
+ <USelect
142
+ v-model="languageModel"
143
+ :items="languageItems"
144
+ size="sm"
145
+ :class="props.isCompact ? 'w-full' : 'w-56'"
146
+ icon="i-ph-translate"
147
+ :aria-label="$t('dms_lang.matrix.translate_into')"
148
+ />
149
+ <USelect
150
+ v-model="namespaceModel"
151
+ :items="namespaceItems"
152
+ size="sm"
153
+ :class="props.isCompact ? 'w-full' : 'w-44'"
154
+ icon="i-ph-folder-simple"
155
+ :aria-label="$t('dms_lang.matrix.namespace')"
156
+ />
157
+ <UInput
158
+ v-model="searchInput"
159
+ icon="i-ph-magnifying-glass"
160
+ size="sm"
161
+ :class="props.isCompact ? 'w-full' : 'min-w-48 flex-1'"
162
+ :placeholder="$t('dms_lang.matrix.search')"
163
+ :aria-label="$t('dms_lang.matrix.search')"
164
+ />
165
+ <slot />
166
+ </div>
167
+ </template>
@@ -0,0 +1,60 @@
1
+ <script setup lang="ts">
2
+ import { QUEUE_KEYS } from '../../../utils/shortcuts'
3
+ import ShortcutKbds from '../ShortcutKbds.vue'
4
+ import { useQueue } from '../../composables/useQueueContext'
5
+
6
+ const { canEditValues } = useWorkspaceContext()
7
+ const { session, save, skip } = useQueue()
8
+ const { isSaving, isArmed } = save
9
+ </script>
10
+
11
+ <template>
12
+ <div class="border-default border-t px-4 py-3">
13
+ <div class="flex flex-wrap items-center gap-2">
14
+ <UButton
15
+ icon="i-ph-arrow-left"
16
+ color="neutral"
17
+ variant="ghost"
18
+ size="sm"
19
+ :disabled="!session.canGoBack.value"
20
+ @click="session.previous()"
21
+ >
22
+ {{ $t('dms_lang.queue.previous') }}
23
+ <ShortcutKbds :keys="QUEUE_KEYS.previous" />
24
+ </UButton>
25
+ <div class="flex-1" />
26
+ <UButton color="neutral" variant="outline" size="sm" @click="skip">
27
+ {{ $t('dms_lang.queue.skip') }}
28
+ <ShortcutKbds :keys="QUEUE_KEYS.skip" />
29
+ </UButton>
30
+ <UButton
31
+ v-if="canEditValues"
32
+ icon="i-ph-check"
33
+ size="sm"
34
+ :color="isArmed ? 'warning' : 'primary'"
35
+ :loading="isSaving"
36
+ @click="save.save()"
37
+ >
38
+ {{
39
+ isArmed
40
+ ? $t('dms_lang.queue.save_anyway')
41
+ : $t('dms_lang.queue.save_next')
42
+ }}
43
+ <ShortcutKbds :keys="QUEUE_KEYS.saveNext" />
44
+ </UButton>
45
+ </div>
46
+ <p class="text-dimmed mt-2 text-xs">
47
+ <i18n-t keypath="dms_lang.queue.shortcuts_hint" scope="global" tag="span">
48
+ <template #leave>
49
+ <ShortcutKbds :keys="QUEUE_KEYS.leaveField" />
50
+ </template>
51
+ <template #skip>
52
+ <ShortcutKbds :keys="QUEUE_KEYS.skip" />
53
+ </template>
54
+ <template #previous>
55
+ <ShortcutKbds :keys="QUEUE_KEYS.previous" />
56
+ </template>
57
+ </i18n-t>
58
+ </p>
59
+ </div>
60
+ </template>
@@ -0,0 +1,185 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ QUEUE_MODES,
4
+ type QueueMode,
5
+ } from '../../../composables/translation/useLanguageQueue'
6
+ import { useQueue } from '../../composables/useQueueContext'
7
+
8
+ /** The title and the description of the end of a pass. */
9
+ interface DoneTexts {
10
+ title: () => string
11
+ description: () => string
12
+ }
13
+
14
+ interface DoneAction {
15
+ label: string
16
+ icon?: string
17
+ color?: 'primary' | 'neutral'
18
+ variant?: 'solid' | 'outline'
19
+ to?: string
20
+ onClick?: () => void
21
+ }
22
+
23
+ const { t } = useI18n()
24
+ const { formatCount } = useLangFormat()
25
+ const { flat } = useWorkspaceFlat()
26
+ const links = useLangLinks()
27
+ const { session, languageName, nameOf } = useQueue()
28
+ const { mode, namespace, counts, missingTotal, queue, otherLanguages } = session
29
+
30
+ function missingOf(code: string): number {
31
+ return flat.value.localeMissing[code] ?? 0
32
+ }
33
+
34
+ const missingElsewhere = computed(
35
+ () => missingTotal.value - counts.value.missing,
36
+ )
37
+
38
+ function languageDescription(): string {
39
+ const name = languageName.value
40
+ if (missingTotal.value)
41
+ return t(
42
+ 'dms_lang.queue.still_missing',
43
+ { n: formatCount(missingTotal.value), name },
44
+ missingTotal.value,
45
+ )
46
+ const total = flat.value.totalKeys
47
+ return t(
48
+ 'dms_lang.queue.done_description',
49
+ { count: formatCount(total), name },
50
+ total,
51
+ )
52
+ }
53
+
54
+ const DONE_TEXTS: Record<QueueMode, DoneTexts> = {
55
+ missing: {
56
+ title: () => t('dms_lang.queue.done_title', { name: languageName.value }),
57
+ description: languageDescription,
58
+ },
59
+ issues: {
60
+ title: () => t('dms_lang.queue.no_issues_title'),
61
+ description: () => t('dms_lang.queue.no_issues_description'),
62
+ },
63
+ all: {
64
+ title: () => t('dms_lang.queue.reviewed_title'),
65
+ description: languageDescription,
66
+ },
67
+ }
68
+
69
+ /** A pass over one namespace: what is left is in the other namespaces. */
70
+ const SCOPED_TEXTS: DoneTexts = {
71
+ title: () =>
72
+ t('dms_lang.queue.done_scope_title', {
73
+ namespace: namespace.value,
74
+ name: languageName.value,
75
+ }),
76
+ description: () =>
77
+ t(
78
+ 'dms_lang.queue.missing_elsewhere',
79
+ { n: formatCount(missingElsewhere.value) },
80
+ missingElsewhere.value,
81
+ ),
82
+ }
83
+
84
+ /** Modes whose end says nothing about the namespace (no issue is no issue anywhere it was looked for). */
85
+ const UNSCOPED_MODES: QueueMode[] = ['issues']
86
+
87
+ const texts = computed(() =>
88
+ namespace.value && !UNSCOPED_MODES.includes(mode.value)
89
+ ? SCOPED_TEXTS
90
+ : DONE_TEXTS[mode.value],
91
+ )
92
+
93
+ function restartAction(): DoneAction | null {
94
+ if (!queue.value.length) return null
95
+ return {
96
+ label: t('dms_lang.queue.restart', {
97
+ count: formatCount(queue.value.length),
98
+ }),
99
+ icon: 'i-ph-arrow-counter-clockwise',
100
+ onClick: () => session.start(),
101
+ }
102
+ }
103
+
104
+ function clearScopeAction(): DoneAction | null {
105
+ if (!namespace.value || !missingElsewhere.value) return null
106
+ return {
107
+ label: t('dms_lang.language_namespaces.clear'),
108
+ icon: 'i-ph-squares-four',
109
+ onClick: () => (namespace.value = ''),
110
+ }
111
+ }
112
+
113
+ /** The modes a finished pass offers to go on with, while they hold keys. */
114
+ const MODE_SWITCHES: Partial<Record<QueueMode, () => string>> = {
115
+ missing: () => t('dms_lang.queue.translate_missing'),
116
+ issues: () =>
117
+ t('dms_lang.queue.review_issues', {
118
+ count: formatCount(counts.value.issues),
119
+ }),
120
+ }
121
+
122
+ function modeActions(): DoneAction[] {
123
+ return QUEUE_MODES.filter(
124
+ (other) => other !== mode.value && counts.value[other],
125
+ ).flatMap((other) => {
126
+ const label = MODE_SWITCHES[other]
127
+ return label
128
+ ? [{ label: label(), onClick: () => (mode.value = other) }]
129
+ : []
130
+ })
131
+ }
132
+
133
+ function nextLanguageAction(): DoneAction | null {
134
+ const code = otherLanguages.value.find((entry) => missingOf(entry) > 0)
135
+ if (!code) return null
136
+ const missing = missingOf(code)
137
+ return {
138
+ label: t(
139
+ 'dms_lang.queue.next_language',
140
+ { name: nameOf(code), n: formatCount(missing) },
141
+ missing,
142
+ ),
143
+ icon: 'i-ph-arrow-right',
144
+ to: links.language(code),
145
+ }
146
+ }
147
+
148
+ function previousAction(): DoneAction | null {
149
+ if (!session.canGoBack.value) return null
150
+ return {
151
+ label: t('dms_lang.queue.previous'),
152
+ icon: 'i-ph-arrow-left',
153
+ onClick: () => session.previous(),
154
+ }
155
+ }
156
+
157
+ /** The ways on from the end of a pass, the first one as the main action. */
158
+ const actions = computed<DoneAction[]>(() =>
159
+ [
160
+ restartAction(),
161
+ clearScopeAction(),
162
+ ...modeActions(),
163
+ nextLanguageAction(),
164
+ previousAction(),
165
+ { label: t('dms_lang.queue.back'), to: links.overview() },
166
+ ]
167
+ .filter((action): action is DoneAction => action !== null)
168
+ .map((action, index) => ({
169
+ color: index === 0 ? 'primary' : 'neutral',
170
+ variant: index === 0 ? 'solid' : 'outline',
171
+ ...action,
172
+ })),
173
+ )
174
+ </script>
175
+
176
+ <template>
177
+ <DmsEmptyState
178
+ icon="i-ph-check-circle"
179
+ tone="success"
180
+ size="lg"
181
+ :title="texts.title()"
182
+ :description="texts.description()"
183
+ :actions="actions"
184
+ />
185
+ </template>