@antelopejs/dms-lang 0.0.7 → 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 +8 -6
- package/package.json +8 -6
- 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,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
|
-
}
|
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { DropdownMenuItem } from "@nuxt/ui";
|
|
3
|
-
import type { WorkspaceLocale } from "../../composables/translation/useI18nWorkspaces";
|
|
4
|
-
|
|
5
|
-
interface LanguageCard {
|
|
6
|
-
code: string;
|
|
7
|
-
name: string;
|
|
8
|
-
flag: string;
|
|
9
|
-
coverage: number;
|
|
10
|
-
missing: number;
|
|
11
|
-
isDefault: boolean;
|
|
12
|
-
isRtl: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface KpiItem {
|
|
16
|
-
key: string;
|
|
17
|
-
title: string;
|
|
18
|
-
icon: string;
|
|
19
|
-
value: number;
|
|
20
|
-
format: "number" | "compact" | "percent";
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const TRANSLATIONS_PATH = "/modules/lang/translations";
|
|
24
|
-
const HIGH_COVERAGE = 90;
|
|
25
|
-
const MID_COVERAGE = 60;
|
|
26
|
-
const FULL_COVERAGE = 100;
|
|
27
|
-
const RTL_CODES = ["ar", "he", "fa", "ur", "ps", "sd", "ug", "yi", "dv"];
|
|
28
|
-
|
|
29
|
-
const { t } = useI18n();
|
|
30
|
-
const { confirm } = useConfirm();
|
|
31
|
-
const { localeMetaOf } = useLocaleMeta();
|
|
32
|
-
const { tryMutate } = useMutationToast();
|
|
33
|
-
|
|
34
|
-
const {
|
|
35
|
-
editable: devEditable,
|
|
36
|
-
selectedWorkspace,
|
|
37
|
-
fetchWorkspaces,
|
|
38
|
-
canUseWorkspaceId,
|
|
39
|
-
renameWorkspace,
|
|
40
|
-
deleteWorkspace,
|
|
41
|
-
setDefaultLocale,
|
|
42
|
-
} = useI18nWorkspaces();
|
|
43
|
-
|
|
44
|
-
const { current, canManage } = useWorkspaceContext();
|
|
45
|
-
|
|
46
|
-
const { flat, isLoading, reload, removeLanguage } = useWorkspaceFlat();
|
|
47
|
-
|
|
48
|
-
function localeLabelOf(locale: WorkspaceLocale): string {
|
|
49
|
-
return locale.name || localeMetaOf(locale.code).name;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function localeFlagOf(locale: WorkspaceLocale): string {
|
|
53
|
-
return locale.flag || localeMetaOf(locale.code).flag;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const cards = computed<LanguageCard[]>(() => {
|
|
57
|
-
const fallback = flat.value.defaultLocale;
|
|
58
|
-
return (current.value?.locales ?? [])
|
|
59
|
-
.map((locale) => ({
|
|
60
|
-
code: locale.code,
|
|
61
|
-
name: localeLabelOf(locale),
|
|
62
|
-
flag: localeFlagOf(locale),
|
|
63
|
-
coverage: flat.value.localeProgress[locale.code] ?? 0,
|
|
64
|
-
missing: flat.value.localeMissing[locale.code] ?? 0,
|
|
65
|
-
isDefault: locale.code === fallback,
|
|
66
|
-
isRtl: RTL_CODES.includes(locale.code),
|
|
67
|
-
}))
|
|
68
|
-
.sort((a, b) => a.coverage - b.coverage);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const missingCount = computed(() =>
|
|
72
|
-
cards.value
|
|
73
|
-
.filter((card) => !card.isDefault)
|
|
74
|
-
.reduce((sum, card) => sum + card.missing, 0),
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const coverage = computed(() => {
|
|
78
|
-
const targets = cards.value.filter((card) => !card.isDefault);
|
|
79
|
-
return targets.length
|
|
80
|
-
? Math.round(
|
|
81
|
-
targets.reduce((sum, card) => sum + card.coverage, 0) / targets.length,
|
|
82
|
-
)
|
|
83
|
-
: FULL_COVERAGE;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const kpis = computed<KpiItem[]>(() => [
|
|
87
|
-
{
|
|
88
|
-
key: "languages",
|
|
89
|
-
title: t("dms_lang.overview.kpi_languages"),
|
|
90
|
-
icon: "i-ph-globe",
|
|
91
|
-
value: flat.value.locales.length,
|
|
92
|
-
format: "number",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
key: "keys",
|
|
96
|
-
title: t("dms_lang.overview.kpi_keys"),
|
|
97
|
-
icon: "i-ph-list-bullets",
|
|
98
|
-
value: flat.value.totalKeys,
|
|
99
|
-
format: "compact",
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
key: "missing",
|
|
103
|
-
title: t("dms_lang.overview.kpi_missing"),
|
|
104
|
-
icon: "i-ph-warning",
|
|
105
|
-
value: missingCount.value,
|
|
106
|
-
format: "number",
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
key: "coverage",
|
|
110
|
-
title: t("dms_lang.overview.kpi_coverage"),
|
|
111
|
-
icon: "i-ph-chart-line-up",
|
|
112
|
-
value: coverage.value,
|
|
113
|
-
format: "percent",
|
|
114
|
-
},
|
|
115
|
-
]);
|
|
116
|
-
|
|
117
|
-
const hasKeys = computed(() => flat.value.totalKeys > 0);
|
|
118
|
-
|
|
119
|
-
function coverageColor(progress: number): string {
|
|
120
|
-
if (!hasKeys.value) return "neutral";
|
|
121
|
-
if (progress >= HIGH_COVERAGE) return "success";
|
|
122
|
-
if (progress >= MID_COVERAGE) return "warning";
|
|
123
|
-
return "error";
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function translateTarget(card: LanguageCard): string {
|
|
127
|
-
return card.missing > 0
|
|
128
|
-
? `${TRANSLATIONS_PATH}?filter=missing&locale=${card.code}`
|
|
129
|
-
: TRANSLATIONS_PATH;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const langAddOpen = ref(false);
|
|
133
|
-
|
|
134
|
-
async function makeDefault(code: string) {
|
|
135
|
-
const ok = await tryMutate(() =>
|
|
136
|
-
setDefaultLocale(selectedWorkspace.value, code),
|
|
137
|
-
);
|
|
138
|
-
if (!ok) return;
|
|
139
|
-
await reload();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const wsRenameOpen = ref(false);
|
|
143
|
-
const wsRenameForm = ref({ id: "", newId: "" });
|
|
144
|
-
|
|
145
|
-
function openRenameWorkspace() {
|
|
146
|
-
wsRenameForm.value = {
|
|
147
|
-
id: selectedWorkspace.value,
|
|
148
|
-
newId: selectedWorkspace.value,
|
|
149
|
-
};
|
|
150
|
-
wsRenameOpen.value = true;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const renamedId = computed(() =>
|
|
154
|
-
normalizeWorkspaceId(wsRenameForm.value.newId),
|
|
155
|
-
);
|
|
156
|
-
const canRename = computed(() => canUseWorkspaceId(renamedId.value));
|
|
157
|
-
|
|
158
|
-
async function submitRenameWorkspace() {
|
|
159
|
-
if (!canRename.value) return;
|
|
160
|
-
const ok = await tryMutate(() =>
|
|
161
|
-
renameWorkspace(wsRenameForm.value.id, renamedId.value),
|
|
162
|
-
);
|
|
163
|
-
if (!ok) return;
|
|
164
|
-
wsRenameOpen.value = false;
|
|
165
|
-
const list = await fetchWorkspaces();
|
|
166
|
-
if (list.some((workspace) => workspace.id === renamedId.value)) {
|
|
167
|
-
selectedWorkspace.value = renamedId.value;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async function requestDeleteWorkspace() {
|
|
172
|
-
const id = selectedWorkspace.value;
|
|
173
|
-
const confirmed = await confirm({
|
|
174
|
-
title: t("dms_lang.translation.ws_delete_workspace_title"),
|
|
175
|
-
description: t("dms_lang.translation.ws_delete_workspace_confirm", {
|
|
176
|
-
name: id,
|
|
177
|
-
}),
|
|
178
|
-
confirmLabel: t("dms_lang.translation.ws_delete"),
|
|
179
|
-
confirmColor: "error",
|
|
180
|
-
});
|
|
181
|
-
if (!confirmed) return;
|
|
182
|
-
const ok = await tryMutate(() => deleteWorkspace(id));
|
|
183
|
-
if (!ok) return;
|
|
184
|
-
await fetchWorkspaces();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const workspaceMenu = computed<DropdownMenuItem[][]>(() => [
|
|
188
|
-
[
|
|
189
|
-
{
|
|
190
|
-
label: t("dms_lang.translation.ws_rename"),
|
|
191
|
-
icon: "i-lucide-pencil",
|
|
192
|
-
onSelect: openRenameWorkspace,
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
label: t("dms_lang.translation.ws_delete"),
|
|
196
|
-
icon: "i-lucide-trash-2",
|
|
197
|
-
color: "error",
|
|
198
|
-
onSelect: requestDeleteWorkspace,
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
]);
|
|
202
|
-
</script>
|
|
203
|
-
|
|
204
|
-
<template>
|
|
205
|
-
<div class="space-y-6">
|
|
206
|
-
<div class="flex flex-wrap items-center gap-3">
|
|
207
|
-
<DmsLangWorkspaceStatus />
|
|
208
|
-
|
|
209
|
-
<UDropdownMenu v-if="canManage" :items="workspaceMenu">
|
|
210
|
-
<UButton
|
|
211
|
-
icon="i-lucide-ellipsis"
|
|
212
|
-
color="neutral"
|
|
213
|
-
variant="ghost"
|
|
214
|
-
size="sm"
|
|
215
|
-
:aria-label="$t('dms_lang.translation.ws_actions')"
|
|
216
|
-
/>
|
|
217
|
-
</UDropdownMenu>
|
|
218
|
-
|
|
219
|
-
<div class="flex-1" />
|
|
220
|
-
|
|
221
|
-
<UButton
|
|
222
|
-
:to="TRANSLATIONS_PATH"
|
|
223
|
-
icon="i-lucide-languages"
|
|
224
|
-
color="neutral"
|
|
225
|
-
variant="subtle"
|
|
226
|
-
:label="$t('dms_lang.overview.open_editor')"
|
|
227
|
-
/>
|
|
228
|
-
<UTooltip
|
|
229
|
-
v-if="devEditable"
|
|
230
|
-
:text="canManage ? undefined : $t('dms_lang.translation.ws_add_language_locked')"
|
|
231
|
-
>
|
|
232
|
-
<UButton
|
|
233
|
-
icon="i-lucide-plus"
|
|
234
|
-
color="neutral"
|
|
235
|
-
variant="subtle"
|
|
236
|
-
:disabled="!canManage"
|
|
237
|
-
:label="$t('dms_lang.translation.ws_add_language')"
|
|
238
|
-
@click="langAddOpen = true"
|
|
239
|
-
/>
|
|
240
|
-
</UTooltip>
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
|
244
|
-
<DmsKpiCard
|
|
245
|
-
v-for="kpi in kpis"
|
|
246
|
-
:key="kpi.key"
|
|
247
|
-
component-id=""
|
|
248
|
-
page-id=""
|
|
249
|
-
variant="stat"
|
|
250
|
-
:title="kpi.title"
|
|
251
|
-
:icon="kpi.icon"
|
|
252
|
-
:static-value="kpi.value"
|
|
253
|
-
:value-format="kpi.format"
|
|
254
|
-
:show-delta="false"
|
|
255
|
-
/>
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
<DmsLangWorkspaceEndpoint />
|
|
259
|
-
|
|
260
|
-
<h2 class="text-highlighted text-base font-semibold">
|
|
261
|
-
{{ $t("dms_lang.translation.ws_languages") }}
|
|
262
|
-
</h2>
|
|
263
|
-
|
|
264
|
-
<div
|
|
265
|
-
v-if="isLoading && !hasKeys"
|
|
266
|
-
class="flex min-h-48 items-center justify-center"
|
|
267
|
-
>
|
|
268
|
-
<UIcon name="i-lucide-loader-circle" class="text-muted size-8 animate-spin" />
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
<div
|
|
272
|
-
v-else-if="cards.length === 0 && !canManage"
|
|
273
|
-
class="text-muted py-12 text-center text-sm"
|
|
274
|
-
>
|
|
275
|
-
{{ $t("dms_lang.translation.ws_no_languages") }}
|
|
276
|
-
</div>
|
|
277
|
-
|
|
278
|
-
<div v-else class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
|
279
|
-
<DmsCard v-for="card in cards" :key="card.code">
|
|
280
|
-
<div class="mb-4 flex items-center gap-3">
|
|
281
|
-
<UIcon
|
|
282
|
-
:name="card.flag ? `flagpack:${card.flag}` : 'i-lucide-globe'"
|
|
283
|
-
class="size-7 shrink-0"
|
|
284
|
-
/>
|
|
285
|
-
<div class="min-w-0 flex-1">
|
|
286
|
-
<div class="text-highlighted truncate font-semibold">{{ card.name }}</div>
|
|
287
|
-
<div class="text-muted font-mono text-xs">{{ card.code }}</div>
|
|
288
|
-
</div>
|
|
289
|
-
<UBadge
|
|
290
|
-
v-if="card.isDefault"
|
|
291
|
-
color="primary"
|
|
292
|
-
variant="subtle"
|
|
293
|
-
icon="i-lucide-star"
|
|
294
|
-
>
|
|
295
|
-
{{ $t("dms_lang.translation.default") }}
|
|
296
|
-
</UBadge>
|
|
297
|
-
<UBadge v-if="card.isRtl" color="neutral" variant="subtle">RTL</UBadge>
|
|
298
|
-
</div>
|
|
299
|
-
|
|
300
|
-
<div class="mb-1.5 flex items-center justify-between">
|
|
301
|
-
<span class="text-muted text-xs">{{ $t("dms_lang.overview.coverage") }}</span>
|
|
302
|
-
<span class="text-highlighted font-mono text-xs">{{ card.coverage }}%</span>
|
|
303
|
-
</div>
|
|
304
|
-
<UProgress :model-value="card.coverage" :color="coverageColor(card.coverage)" />
|
|
305
|
-
<p class="mt-1.5 text-xs" :class="card.missing > 0 ? 'text-warning' : 'text-muted'">
|
|
306
|
-
{{
|
|
307
|
-
card.isDefault
|
|
308
|
-
? $t("dms_lang.overview.base_language")
|
|
309
|
-
: card.missing > 0
|
|
310
|
-
? $t("dms_lang.overview.keys_missing", { count: card.missing })
|
|
311
|
-
: hasKeys
|
|
312
|
-
? $t("dms_lang.overview.complete")
|
|
313
|
-
: "—"
|
|
314
|
-
}}
|
|
315
|
-
</p>
|
|
316
|
-
|
|
317
|
-
<USeparator class="my-4" />
|
|
318
|
-
|
|
319
|
-
<div class="flex flex-wrap gap-2">
|
|
320
|
-
<UButton
|
|
321
|
-
:to="translateTarget(card)"
|
|
322
|
-
icon="i-lucide-languages"
|
|
323
|
-
color="neutral"
|
|
324
|
-
variant="subtle"
|
|
325
|
-
size="xs"
|
|
326
|
-
:label="$t('dms_lang.overview.translate')"
|
|
327
|
-
/>
|
|
328
|
-
<UButton
|
|
329
|
-
v-if="canManage && !card.isDefault"
|
|
330
|
-
color="neutral"
|
|
331
|
-
variant="ghost"
|
|
332
|
-
size="xs"
|
|
333
|
-
:label="$t('dms_lang.overview.set_default')"
|
|
334
|
-
@click="makeDefault(card.code)"
|
|
335
|
-
/>
|
|
336
|
-
<div class="flex-1" />
|
|
337
|
-
<UButton
|
|
338
|
-
v-if="canManage && !card.isDefault"
|
|
339
|
-
icon="i-lucide-trash-2"
|
|
340
|
-
color="error"
|
|
341
|
-
variant="ghost"
|
|
342
|
-
size="xs"
|
|
343
|
-
:aria-label="$t('dms_lang.translation.ws_delete')"
|
|
344
|
-
@click="removeLanguage(card.code)"
|
|
345
|
-
/>
|
|
346
|
-
</div>
|
|
347
|
-
</DmsCard>
|
|
348
|
-
|
|
349
|
-
<button
|
|
350
|
-
v-if="canManage"
|
|
351
|
-
type="button"
|
|
352
|
-
class="border-default text-muted hover:border-primary/50 hover:text-highlighted hover:bg-elevated/30 flex min-h-44 cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border border-dashed transition-colors"
|
|
353
|
-
@click="langAddOpen = true"
|
|
354
|
-
>
|
|
355
|
-
<span
|
|
356
|
-
class="bg-elevated/60 grid size-10 place-items-center rounded-full"
|
|
357
|
-
>
|
|
358
|
-
<UIcon name="i-lucide-plus" class="size-5" />
|
|
359
|
-
</span>
|
|
360
|
-
<span class="text-sm font-medium">
|
|
361
|
-
{{ $t("dms_lang.translation.ws_add_language") }}
|
|
362
|
-
</span>
|
|
363
|
-
</button>
|
|
364
|
-
</div>
|
|
365
|
-
|
|
366
|
-
<DmsLangLanguageAddModal
|
|
367
|
-
v-model:open="langAddOpen"
|
|
368
|
-
@added="reload"
|
|
369
|
-
/>
|
|
370
|
-
|
|
371
|
-
<UModal v-model:open="wsRenameOpen" :title="$t('dms_lang.translation.ws_rename')">
|
|
372
|
-
<template #body>
|
|
373
|
-
<UFormField
|
|
374
|
-
:label="$t('dms_lang.translation.ws_workspace_name')"
|
|
375
|
-
:help="$t('dms_lang.translation.ws_workspace_name_help')"
|
|
376
|
-
>
|
|
377
|
-
<UInput v-model="wsRenameForm.newId" class="w-full" />
|
|
378
|
-
</UFormField>
|
|
379
|
-
</template>
|
|
380
|
-
<template #footer>
|
|
381
|
-
<div class="flex w-full justify-end gap-2">
|
|
382
|
-
<UButton
|
|
383
|
-
color="neutral"
|
|
384
|
-
variant="ghost"
|
|
385
|
-
:label="$t('dms_lang.translation.ws_cancel')"
|
|
386
|
-
@click="wsRenameOpen = false"
|
|
387
|
-
/>
|
|
388
|
-
<UButton
|
|
389
|
-
:label="$t('dms_lang.translation.ws_save')"
|
|
390
|
-
:disabled="!canRename"
|
|
391
|
-
@click="submitRenameWorkspace"
|
|
392
|
-
/>
|
|
393
|
-
</div>
|
|
394
|
-
</template>
|
|
395
|
-
</UModal>
|
|
396
|
-
</div>
|
|
397
|
-
</template>
|