@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
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { DropdownMenuItem } from "@nuxt/ui";
|
|
3
|
-
import type { WorkspaceSummary } from "../composables/translation/useI18nWorkspaces";
|
|
4
|
-
import type { LanguageCatalogEntry } from "../composables/translation/useLanguageCatalog";
|
|
5
|
-
|
|
6
|
-
interface WorkspaceForm extends LanguageCatalogEntry {
|
|
7
|
-
id: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
collapsed?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const EMPTY_FORM: WorkspaceForm = { id: "", code: "", name: "", flag: "" };
|
|
15
|
-
|
|
16
|
-
defineProps<Props>();
|
|
17
|
-
|
|
18
|
-
const { t } = useI18n();
|
|
19
|
-
const { tryMutate } = useMutationToast();
|
|
20
|
-
const { current } = useWorkspaceContext();
|
|
21
|
-
const { items: languageItems, resolveLanguage } = useLanguageCatalog();
|
|
22
|
-
const {
|
|
23
|
-
workspaces,
|
|
24
|
-
editable,
|
|
25
|
-
selectedWorkspace,
|
|
26
|
-
isLoading,
|
|
27
|
-
fetchWorkspaces,
|
|
28
|
-
canUseWorkspaceId,
|
|
29
|
-
createWorkspace,
|
|
30
|
-
} = useI18nWorkspaces();
|
|
31
|
-
|
|
32
|
-
const currentIcon = computed(() =>
|
|
33
|
-
current.value?.editable ? "i-lucide-pencil" : "i-lucide-lock",
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const subtitle = computed(() =>
|
|
37
|
-
t("dms_lang.sidebar.languages_count", current.value?.locales.length ?? 0),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const menuItems = computed<DropdownMenuItem[][]>(() => {
|
|
41
|
-
const groups: DropdownMenuItem[][] = [
|
|
42
|
-
workspaces.value.map((workspace: WorkspaceSummary) => ({
|
|
43
|
-
label: workspace.id,
|
|
44
|
-
icon: workspace.editable ? "i-lucide-pencil" : "i-lucide-lock",
|
|
45
|
-
type: "checkbox" as const,
|
|
46
|
-
checked: workspace.id === selectedWorkspace.value,
|
|
47
|
-
onSelect: () => {
|
|
48
|
-
selectedWorkspace.value = workspace.id;
|
|
49
|
-
},
|
|
50
|
-
})),
|
|
51
|
-
];
|
|
52
|
-
if (editable.value) {
|
|
53
|
-
groups.push([
|
|
54
|
-
{
|
|
55
|
-
label: t("dms_lang.translation.ws_new"),
|
|
56
|
-
icon: "i-lucide-plus",
|
|
57
|
-
onSelect: openCreateWorkspace,
|
|
58
|
-
},
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
61
|
-
return groups;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const createOpen = ref(false);
|
|
65
|
-
const createForm = ref<WorkspaceForm>({ ...EMPTY_FORM });
|
|
66
|
-
const isSubmitting = ref(false);
|
|
67
|
-
|
|
68
|
-
const normalizedId = computed(() => normalizeWorkspaceId(createForm.value.id));
|
|
69
|
-
const canCreate = computed(
|
|
70
|
-
() => canUseWorkspaceId(normalizedId.value) && Boolean(createForm.value.code),
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
function openCreateWorkspace() {
|
|
74
|
-
createForm.value = { ...EMPTY_FORM };
|
|
75
|
-
createOpen.value = true;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function submitCreateWorkspace() {
|
|
79
|
-
if (isSubmitting.value || !canCreate.value) return;
|
|
80
|
-
const id = normalizedId.value;
|
|
81
|
-
const { code, name, flag } = createForm.value;
|
|
82
|
-
isSubmitting.value = true;
|
|
83
|
-
const ok = await tryMutate(() =>
|
|
84
|
-
createWorkspace(id, { code, name: name || undefined, flag: flag || undefined }),
|
|
85
|
-
);
|
|
86
|
-
isSubmitting.value = false;
|
|
87
|
-
if (!ok) return;
|
|
88
|
-
createOpen.value = false;
|
|
89
|
-
const list = await fetchWorkspaces();
|
|
90
|
-
if (list.some((workspace) => workspace.id === id)) {
|
|
91
|
-
selectedWorkspace.value = id;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
onMounted(() => {
|
|
96
|
-
if (workspaces.value.length === 0) fetchWorkspaces();
|
|
97
|
-
});
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<template>
|
|
101
|
-
<UDropdownMenu
|
|
102
|
-
v-if="workspaces.length > 0"
|
|
103
|
-
:items="menuItems"
|
|
104
|
-
:content="{ align: 'start' }"
|
|
105
|
-
:ui="{ content: 'w-56' }"
|
|
106
|
-
>
|
|
107
|
-
<button
|
|
108
|
-
type="button"
|
|
109
|
-
class="border-default hover:bg-elevated/50 flex w-full items-center gap-2.5 rounded-lg border p-2 text-left transition-colors"
|
|
110
|
-
:class="{ 'justify-center border-transparent p-1.5': collapsed }"
|
|
111
|
-
:aria-label="collapsed ? t('dms_lang.sidebar.workspace') : undefined"
|
|
112
|
-
>
|
|
113
|
-
<span
|
|
114
|
-
class="bg-primary/10 ring-primary/20 grid size-8 shrink-0 place-items-center rounded-md ring"
|
|
115
|
-
>
|
|
116
|
-
<UIcon :name="currentIcon" class="text-primary size-4" />
|
|
117
|
-
</span>
|
|
118
|
-
<template v-if="!collapsed">
|
|
119
|
-
<span class="min-w-0 flex-1">
|
|
120
|
-
<span class="text-highlighted block truncate text-sm font-semibold">
|
|
121
|
-
{{ selectedWorkspace || t("dms_lang.sidebar.workspace") }}
|
|
122
|
-
</span>
|
|
123
|
-
<span class="text-muted block truncate text-xs">{{ subtitle }}</span>
|
|
124
|
-
</span>
|
|
125
|
-
<UIcon
|
|
126
|
-
name="i-lucide-chevrons-up-down"
|
|
127
|
-
class="text-muted size-4 shrink-0"
|
|
128
|
-
/>
|
|
129
|
-
</template>
|
|
130
|
-
</button>
|
|
131
|
-
</UDropdownMenu>
|
|
132
|
-
<USkeleton
|
|
133
|
-
v-else-if="isLoading"
|
|
134
|
-
class="rounded-lg"
|
|
135
|
-
:class="collapsed ? 'mx-auto size-11' : 'h-12 w-full'"
|
|
136
|
-
/>
|
|
137
|
-
|
|
138
|
-
<UModal v-model:open="createOpen" :title="$t('dms_lang.translation.ws_new')">
|
|
139
|
-
<template #body>
|
|
140
|
-
<div class="space-y-4">
|
|
141
|
-
<UFormField
|
|
142
|
-
:label="$t('dms_lang.translation.ws_workspace_name')"
|
|
143
|
-
:help="$t('dms_lang.translation.ws_workspace_name_help')"
|
|
144
|
-
>
|
|
145
|
-
<UInput v-model="createForm.id" class="w-full" />
|
|
146
|
-
</UFormField>
|
|
147
|
-
<UFormField :label="$t('dms_lang.translation.ws_default_locale')">
|
|
148
|
-
<USelectMenu
|
|
149
|
-
:model-value="createForm.code"
|
|
150
|
-
:items="languageItems"
|
|
151
|
-
value-key="value"
|
|
152
|
-
label-key="label"
|
|
153
|
-
searchable
|
|
154
|
-
class="w-full"
|
|
155
|
-
:placeholder="$t('dms_lang.translation.ws_language_select')"
|
|
156
|
-
@update:model-value="
|
|
157
|
-
createForm = { ...resolveLanguage($event), id: createForm.id }
|
|
158
|
-
"
|
|
159
|
-
/>
|
|
160
|
-
</UFormField>
|
|
161
|
-
</div>
|
|
162
|
-
</template>
|
|
163
|
-
<template #footer>
|
|
164
|
-
<div class="flex w-full justify-end gap-2">
|
|
165
|
-
<UButton
|
|
166
|
-
color="neutral"
|
|
167
|
-
variant="ghost"
|
|
168
|
-
:label="$t('dms_lang.translation.ws_cancel')"
|
|
169
|
-
@click="createOpen = false"
|
|
170
|
-
/>
|
|
171
|
-
<UButton
|
|
172
|
-
:label="$t('dms_lang.translation.ws_create')"
|
|
173
|
-
:loading="isSubmitting"
|
|
174
|
-
:disabled="!canCreate"
|
|
175
|
-
@click="submitCreateWorkspace"
|
|
176
|
-
/>
|
|
177
|
-
</div>
|
|
178
|
-
</template>
|
|
179
|
-
</UModal>
|
|
180
|
-
</template>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const { isDefault, isModules, isEditable } = useWorkspaceContext();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<UBadge
|
|
7
|
-
:color="isEditable ? 'primary' : 'warning'"
|
|
8
|
-
variant="subtle"
|
|
9
|
-
:icon="isEditable ? 'i-lucide-pencil' : 'i-lucide-lock'"
|
|
10
|
-
>
|
|
11
|
-
{{
|
|
12
|
-
isEditable
|
|
13
|
-
? $t("dms_lang.translation.ws_editable")
|
|
14
|
-
: $t("dms_lang.translation.ws_read_only")
|
|
15
|
-
}}
|
|
16
|
-
</UBadge>
|
|
17
|
-
|
|
18
|
-
<p v-if="isDefault" class="text-muted text-sm">
|
|
19
|
-
{{ $t("dms_lang.translation.ws_default_hint") }}
|
|
20
|
-
</p>
|
|
21
|
-
<p v-else-if="isModules" class="text-muted text-sm">
|
|
22
|
-
{{ $t("dms_lang.translation.ws_modules_hint") }}
|
|
23
|
-
</p>
|
|
24
|
-
</template>
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
export interface LanguageCatalogEntry {
|
|
2
|
-
code: string;
|
|
3
|
-
name: string;
|
|
4
|
-
flag: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const LANGUAGES: LanguageCatalogEntry[] = [
|
|
8
|
-
{ code: "en", name: "English", flag: "gb-ukm" },
|
|
9
|
-
{ code: "fr", name: "Français", flag: "fr" },
|
|
10
|
-
{ code: "es", name: "Español", flag: "es" },
|
|
11
|
-
{ code: "de", name: "Deutsch", flag: "de" },
|
|
12
|
-
{ code: "it", name: "Italiano", flag: "it" },
|
|
13
|
-
{ code: "pt", name: "Português", flag: "pt" },
|
|
14
|
-
{ code: "nl", name: "Nederlands", flag: "nl" },
|
|
15
|
-
{ code: "ru", name: "Русский", flag: "ru" },
|
|
16
|
-
{ code: "zh", name: "中文", flag: "cn" },
|
|
17
|
-
{ code: "ja", name: "日本語", flag: "jp" },
|
|
18
|
-
{ code: "ko", name: "한국어", flag: "kr" },
|
|
19
|
-
{ code: "ar", name: "العربية", flag: "sa" },
|
|
20
|
-
{ code: "hi", name: "हिन्दी", flag: "in" },
|
|
21
|
-
{ code: "bn", name: "বাংলা", flag: "bd" },
|
|
22
|
-
{ code: "tr", name: "Türkçe", flag: "tr" },
|
|
23
|
-
{ code: "pl", name: "Polski", flag: "pl" },
|
|
24
|
-
{ code: "uk", name: "Українська", flag: "ua" },
|
|
25
|
-
{ code: "ro", name: "Română", flag: "ro" },
|
|
26
|
-
{ code: "el", name: "Ελληνικά", flag: "gr" },
|
|
27
|
-
{ code: "cs", name: "Čeština", flag: "cz" },
|
|
28
|
-
{ code: "sv", name: "Svenska", flag: "se" },
|
|
29
|
-
{ code: "da", name: "Dansk", flag: "dk" },
|
|
30
|
-
{ code: "fi", name: "Suomi", flag: "fi" },
|
|
31
|
-
{ code: "no", name: "Norsk", flag: "no" },
|
|
32
|
-
{ code: "hu", name: "Magyar", flag: "hu" },
|
|
33
|
-
{ code: "sk", name: "Slovenčina", flag: "sk" },
|
|
34
|
-
{ code: "bg", name: "Български", flag: "bg" },
|
|
35
|
-
{ code: "hr", name: "Hrvatski", flag: "hr" },
|
|
36
|
-
{ code: "sr", name: "Српски", flag: "rs" },
|
|
37
|
-
{ code: "sl", name: "Slovenščina", flag: "si" },
|
|
38
|
-
{ code: "et", name: "Eesti", flag: "ee" },
|
|
39
|
-
{ code: "lv", name: "Latviešu", flag: "lv" },
|
|
40
|
-
{ code: "lt", name: "Lietuvių", flag: "lt" },
|
|
41
|
-
{ code: "he", name: "עברית", flag: "il" },
|
|
42
|
-
{ code: "th", name: "ไทย", flag: "th" },
|
|
43
|
-
{ code: "vi", name: "Tiếng Việt", flag: "vn" },
|
|
44
|
-
{ code: "id", name: "Bahasa Indonesia", flag: "id" },
|
|
45
|
-
{ code: "ms", name: "Bahasa Melayu", flag: "my" },
|
|
46
|
-
{ code: "fa", name: "فارسی", flag: "ir" },
|
|
47
|
-
{ code: "ur", name: "اردو", flag: "pk" },
|
|
48
|
-
{ code: "ta", name: "தமிழ்", flag: "in" },
|
|
49
|
-
{ code: "te", name: "తెలుగు", flag: "in" },
|
|
50
|
-
{ code: "sw", name: "Kiswahili", flag: "ke" },
|
|
51
|
-
{ code: "af", name: "Afrikaans", flag: "za" },
|
|
52
|
-
{ code: "is", name: "Íslenska", flag: "is" },
|
|
53
|
-
{ code: "ga", name: "Gaeilge", flag: "ie" },
|
|
54
|
-
{ code: "sq", name: "Shqip", flag: "al" },
|
|
55
|
-
{ code: "mk", name: "Македонски", flag: "mk" },
|
|
56
|
-
{ code: "bs", name: "Bosanski", flag: "ba" },
|
|
57
|
-
{ code: "ka", name: "ქართული", flag: "ge" },
|
|
58
|
-
{ code: "hy", name: "Հայերեն", flag: "am" },
|
|
59
|
-
{ code: "az", name: "Azərbaycan", flag: "az" },
|
|
60
|
-
{ code: "kk", name: "Қазақ", flag: "kz" },
|
|
61
|
-
{ code: "uz", name: "Oʻzbek", flag: "uz" },
|
|
62
|
-
{ code: "mn", name: "Монгол", flag: "mn" },
|
|
63
|
-
{ code: "ne", name: "नेपाली", flag: "np" },
|
|
64
|
-
{ code: "si", name: "සිංහල", flag: "lk" },
|
|
65
|
-
{ code: "km", name: "ខ្មែរ", flag: "kh" },
|
|
66
|
-
{ code: "my", name: "မြန်မာ", flag: "mm" },
|
|
67
|
-
{ code: "am", name: "አማርኛ", flag: "et" },
|
|
68
|
-
{ code: "tl", name: "Tagalog", flag: "ph" },
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
export interface LanguageSelectItem {
|
|
72
|
-
label: string;
|
|
73
|
-
value: string;
|
|
74
|
-
icon: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const BY_CODE = new Map(LANGUAGES.map((lang) => [lang.code, lang]));
|
|
78
|
-
|
|
79
|
-
const ITEMS: LanguageSelectItem[] = LANGUAGES.map((lang) => ({
|
|
80
|
-
label: `${lang.name} (${lang.code})`,
|
|
81
|
-
value: lang.code,
|
|
82
|
-
icon: `flagpack:${lang.flag}`,
|
|
83
|
-
}));
|
|
84
|
-
|
|
85
|
-
export const useLanguageCatalog = () => {
|
|
86
|
-
const resolveLanguage = (code: string): LanguageCatalogEntry =>
|
|
87
|
-
BY_CODE.get(code) ?? { code, name: code, flag: "" };
|
|
88
|
-
|
|
89
|
-
return { items: ITEMS, resolveLanguage };
|
|
90
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface LocaleMeta {
|
|
2
|
-
name: string
|
|
3
|
-
flag: string
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export const useLocaleMeta = () => {
|
|
7
|
-
const { uniqueLocales } = useUniqueLocales()
|
|
8
|
-
const { resolveLanguage } = useLanguageCatalog()
|
|
9
|
-
|
|
10
|
-
function localeMetaOf(code: string): LocaleMeta {
|
|
11
|
-
const meta = uniqueLocales.value.find((locale) => locale.code === code)
|
|
12
|
-
const language = resolveLanguage(code)
|
|
13
|
-
const name = language.name === code ? meta?.name ?? code : language.name
|
|
14
|
-
return { name, flag: language.flag }
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return { localeMetaOf }
|
|
18
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
type TranslationValue = string | number | boolean | null | undefined
|
|
2
|
-
type LocaleFallback = string | string[] | Record<string, string[]> | false
|
|
3
|
-
|
|
4
|
-
const API_BASE = '/api/lang/translations'
|
|
5
|
-
const TRANSLATION_FLAT_ENDPOINT = `${API_BASE}/flat`
|
|
6
|
-
const DEFAULT_LOCALE = 'en'
|
|
7
|
-
|
|
8
|
-
export interface FlatTranslationRow {
|
|
9
|
-
key: string
|
|
10
|
-
values: Record<string, TranslationValue>
|
|
11
|
-
/** Per-locale inherited module value (default workspace only). */
|
|
12
|
-
inherited?: Record<string, TranslationValue>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface FlatTranslations {
|
|
16
|
-
defaultLocale: string
|
|
17
|
-
locales: string[]
|
|
18
|
-
rows: FlatTranslationRow[]
|
|
19
|
-
localeProgress: Record<string, number>
|
|
20
|
-
localeMissing: Record<string, number>
|
|
21
|
-
totalKeys: number
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const EMPTY_FLAT: FlatTranslations = {
|
|
25
|
-
defaultLocale: '',
|
|
26
|
-
locales: [],
|
|
27
|
-
rows: [],
|
|
28
|
-
localeProgress: {},
|
|
29
|
-
localeMissing: {},
|
|
30
|
-
totalKeys: 0,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function isLocaleValueMissing(value: unknown): boolean {
|
|
34
|
-
return value === undefined || value === null || value === ''
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function resolveDefaultLocale(fallback: LocaleFallback): string {
|
|
38
|
-
if (typeof fallback === 'string') return fallback
|
|
39
|
-
if (Array.isArray(fallback)) return fallback[0] ?? DEFAULT_LOCALE
|
|
40
|
-
return (fallback && fallback.default?.[0]) || DEFAULT_LOCALE
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const useTranslationProgress = () => {
|
|
44
|
-
const { $authFetch } = useAuthFetch()
|
|
45
|
-
const { fallbackLocale } = useI18n()
|
|
46
|
-
|
|
47
|
-
async function fetchFlat(
|
|
48
|
-
workspace: string = DEFAULT_WORKSPACE,
|
|
49
|
-
): Promise<FlatTranslations | null> {
|
|
50
|
-
const defaultLocale = resolveDefaultLocale(fallbackLocale.value)
|
|
51
|
-
try {
|
|
52
|
-
const response = await $authFetch<Partial<FlatTranslations>>(
|
|
53
|
-
TRANSLATION_FLAT_ENDPOINT,
|
|
54
|
-
{ query: { defaultLocale, workspace } },
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
defaultLocale: response?.defaultLocale ?? String(defaultLocale),
|
|
59
|
-
locales: response?.locales ?? [],
|
|
60
|
-
rows: response?.rows ?? [],
|
|
61
|
-
localeProgress: response?.localeProgress ?? {},
|
|
62
|
-
localeMissing: response?.localeMissing ?? {},
|
|
63
|
-
totalKeys: response?.totalKeys ?? 0,
|
|
64
|
-
}
|
|
65
|
-
} catch {
|
|
66
|
-
return null
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
fetchFlat,
|
|
72
|
-
}
|
|
73
|
-
}
|