@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-check.js","sourceRoot":"","sources":["../../src/utils/message-check.ts"],"names":[],"mappings":";;AAiHA,0CASC;AA1HD,gEAAmE;AACnE,iCAAmC;AAGnC,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC7C,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,cAAc,GAAG,QAAQ,CAAC;AAgBhC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;AAE5C,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,MAAM,CAAC,IAAa;IAC3B,IAAI,IAAI,CAAC,IAAI,MAAoB,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ;QAC/D,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,IAAI,IAAI,CAAC,IAAI,MAAmB;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,SAAS,CAAC;AACnB,CAAC;AAGD,SAAS,YAAY,CAAC,IAAa,EAAE,KAAkB;IACrD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;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AS,CAAC,IAAY,EAAE,KAAa;IAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnE,IAAI,IAAA,gBAAS,EAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAClC,OAAO,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AAClD,CAAC;AAUD,SAAgB,eAAe,CAAC,IAAa,EAAE,KAAc;IAC3D,IAAI,IAAA,gBAAS,EAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAChE,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,QAAQ,CAAC,IAAI,IAAI,cAAc;QAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IACtD,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messageIssues = messageIssues;
|
|
4
|
+
exports.assertMessageSyntax = assertMessageSyntax;
|
|
5
|
+
const message_compiler_1 = require("@intlify/message-compiler");
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
const DETAIL_PREFIX = "$dms_lang.errors.message_syntax";
|
|
8
|
+
const PROBLEM_NAMES = new Map(Object.entries(message_compiler_1.CompileErrorCodes).map(([name, code]) => [
|
|
9
|
+
code,
|
|
10
|
+
name.toLowerCase(),
|
|
11
|
+
]));
|
|
12
|
+
function messageIssues(message) {
|
|
13
|
+
const issues = new Map();
|
|
14
|
+
(0, message_compiler_1.baseCompile)(message, {
|
|
15
|
+
onError: (error) => {
|
|
16
|
+
const problem = PROBLEM_NAMES.get(error.code) ?? String(error.code);
|
|
17
|
+
if (issues.has(problem))
|
|
18
|
+
return;
|
|
19
|
+
issues.set(problem, {
|
|
20
|
+
problem,
|
|
21
|
+
offset: error.location?.start.offset ?? 0,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return [...issues.values()];
|
|
26
|
+
}
|
|
27
|
+
function assertMessageSyntax(locale, message) {
|
|
28
|
+
const issues = messageIssues(message);
|
|
29
|
+
if (issues.length === 0)
|
|
30
|
+
return;
|
|
31
|
+
(0, errors_1.fail)("invalid_message", {
|
|
32
|
+
locale,
|
|
33
|
+
problems: issues.map((issue) => issue.problem),
|
|
34
|
+
details: issues.map((issue) => `${DETAIL_PREFIX}.${issue.problem}`),
|
|
35
|
+
issues,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=message-syntax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-syntax.js","sourceRoot":"","sources":["../../src/utils/message-syntax.ts"],"names":[],"mappings":";;AAuBA,sCAaC;AAOD,kDASC;AApDD,gEAA2E;AAC3E,qCAAgC;AAEhC,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAGxD,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B,MAAM,CAAC,OAAO,CAAC,oCAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IACtD,IAAI;IACJ,IAAI,CAAC,WAAW,EAAE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aceCoverage {
|
|
7
|
+
locales: string[];
|
|
8
|
+
localeMissing: Record<string, number>;
|
|
9
|
+
namespaces: NamespaceRow[];
|
|
10
|
+
}
|
|
11
|
+
export declare function namespaceCoverage(workspace: string): NamespaceCoverage;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.namespaceCoverage = namespaceCoverage;
|
|
4
|
+
const resolve_1 = require("./resolve");
|
|
5
|
+
const summary_1 = require("./summary");
|
|
6
|
+
const NAMESPACE_SEPARATOR = ".";
|
|
7
|
+
function namespaceOf(key) {
|
|
8
|
+
const index = key.indexOf(NAMESPACE_SEPARATOR);
|
|
9
|
+
return index < 0 ? key : key.slice(0, index);
|
|
10
|
+
}
|
|
11
|
+
function sortedTargets(flat) {
|
|
12
|
+
const missingOf = (code) => flat.localeMissing[code] ?? 0;
|
|
13
|
+
const progressOf = (code) => flat.localeProgress[code] ?? 0;
|
|
14
|
+
return (0, summary_1.targetLocales)(flat).sort((left, right) => progressOf(left) - progressOf(right) ||
|
|
15
|
+
missingOf(right) - missingOf(left) ||
|
|
16
|
+
left.localeCompare(right));
|
|
17
|
+
}
|
|
18
|
+
function emptyRow(namespace, locales) {
|
|
19
|
+
const missing = Object.fromEntries(locales.map((locale) => [locale, 0]));
|
|
20
|
+
return { namespace, keys: 0, missing };
|
|
21
|
+
}
|
|
22
|
+
function countNamespaces(flat, locales) {
|
|
23
|
+
const rows = new Map();
|
|
24
|
+
for (const row of flat.rows) {
|
|
25
|
+
const namespace = namespaceOf(row.key);
|
|
26
|
+
const entry = rows.get(namespace) ?? emptyRow(namespace, locales);
|
|
27
|
+
rows.set(namespace, entry);
|
|
28
|
+
entry.keys += 1;
|
|
29
|
+
for (const locale of locales)
|
|
30
|
+
if ((0, resolve_1.isRowMissing)(row, locale))
|
|
31
|
+
entry.missing[locale] += 1;
|
|
32
|
+
}
|
|
33
|
+
return [...rows.values()];
|
|
34
|
+
}
|
|
35
|
+
function totalMissing(entry) {
|
|
36
|
+
return Object.values(entry.missing).reduce((sum, count) => sum + count, 0);
|
|
37
|
+
}
|
|
38
|
+
function compareNamespaces(left, right) {
|
|
39
|
+
return (totalMissing(right) / right.keys - totalMissing(left) / left.keys ||
|
|
40
|
+
totalMissing(right) - totalMissing(left) ||
|
|
41
|
+
left.namespace.localeCompare(right.namespace));
|
|
42
|
+
}
|
|
43
|
+
function namespaceCoverage(workspace) {
|
|
44
|
+
const flat = (0, resolve_1.resolveFlat)(workspace);
|
|
45
|
+
const locales = sortedTargets(flat);
|
|
46
|
+
return {
|
|
47
|
+
locales,
|
|
48
|
+
localeMissing: flat.localeMissing,
|
|
49
|
+
namespaces: countNamespaces(flat, locales).sort(compareNamespaces),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=namespaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../../src/utils/namespaces.ts"],"names":[],"mappings":";;AAsEA,8CAQC;AA9ED,uCAAuE;AACvE,uCAA0C;AAE1C,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAoBhC,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/C,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,aAAa,CAAC,IAAgB;IACrC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAA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C,CAAC;AAC5B,CAAC;AAED,SAAS,YAAY,CAAC,KAAmB;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAkB,EAAE,KAAmB;IAChE,OAAO,CACL,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI;QACjE,YAAY,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,CAC9C,CAAC;AACJ,CAAC;AAGD,SAAgB,iBAAiB,CAAC,SAAiB;IACjD,MAAM,IAAI,GAAG,IAAA,qBAAW,EAAC,SAAS,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO;QACL,OAAO;QACP,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;KACnE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BannerContent } from "@antelopejs/interface-dms/base/banner";
|
|
2
|
+
export declare const NOTICE_PAGES: readonly ["overview", "workspace"];
|
|
3
|
+
export type NoticePage = (typeof NOTICE_PAGES)[number];
|
|
4
|
+
export declare function workspaceNotice(workspace: string, page: NoticePage): BannerContent;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NOTICE_PAGES = void 0;
|
|
4
|
+
exports.workspaceNotice = workspaceNotice;
|
|
5
|
+
const page_actions_1 = require("../pages/page-actions");
|
|
6
|
+
const catalog_1 = require("./catalog");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const resolve_1 = require("./resolve");
|
|
9
|
+
exports.NOTICE_PAGES = ["overview", "workspace"];
|
|
10
|
+
function pageUrl(page, workspace, action) {
|
|
11
|
+
const query = new URLSearchParams({ workspace });
|
|
12
|
+
if (action)
|
|
13
|
+
query.set(page_actions_1.PAGE_ACTION_QUERY, action);
|
|
14
|
+
return `${constants_1.PAGES_URL}/${page}?${query.toString()}`;
|
|
15
|
+
}
|
|
16
|
+
function notice(name, tone, icon, actions = []) {
|
|
17
|
+
return {
|
|
18
|
+
tone,
|
|
19
|
+
icon,
|
|
20
|
+
title: `$${constants_1.LANG_TEXTS}.notice.${name}_title`,
|
|
21
|
+
description: `$${constants_1.LANG_TEXTS}.notice.${name}_description`,
|
|
22
|
+
actions,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function addLanguageLink(workspace) {
|
|
26
|
+
return {
|
|
27
|
+
label: `$${constants_1.LANG_TEXTS}.languages.add`,
|
|
28
|
+
to: pageUrl("overview", workspace, page_actions_1.PAGE_ACTIONS.addLanguage),
|
|
29
|
+
icon: "i-ph-plus",
|
|
30
|
+
color: "primary",
|
|
31
|
+
variant: "solid",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function addedNotice({ summary, flat, page }) {
|
|
35
|
+
if (page === "workspace")
|
|
36
|
+
return notice("keys", "info", "i-ph-info");
|
|
37
|
+
if (flat.totalKeys === 0 || flat.locales.length > 1)
|
|
38
|
+
return {};
|
|
39
|
+
const actions = summary.editable ? [addLanguageLink(summary.id)] : [];
|
|
40
|
+
return notice("no_target", "info", "i-ph-translate", actions);
|
|
41
|
+
}
|
|
42
|
+
const KIND_NOTICES = {
|
|
43
|
+
added: addedNotice,
|
|
44
|
+
default: () => ({}),
|
|
45
|
+
modules: () => notice("modules", "warning", "i-ph-puzzle-piece", [
|
|
46
|
+
{
|
|
47
|
+
label: `$${constants_1.LANG_TEXTS}.notice.browse_keys`,
|
|
48
|
+
to: pageUrl("translations", "modules"),
|
|
49
|
+
icon: "i-ph-table",
|
|
50
|
+
color: "neutral",
|
|
51
|
+
variant: "outline",
|
|
52
|
+
},
|
|
53
|
+
]),
|
|
54
|
+
};
|
|
55
|
+
function workspaceNotice(workspace, page) {
|
|
56
|
+
const summary = (0, catalog_1.findWorkspace)(workspace);
|
|
57
|
+
const flat = (0, resolve_1.resolveFlat)(summary.id);
|
|
58
|
+
return KIND_NOTICES[summary.kind]({ summary, flat, page });
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=notices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notices.js","sourceRoot":"","sources":["../../src/utils/notices.ts"],"names":[],"mappings":";;;AAkFA,0CAOC;AApFD,wDAAwE;AACxE,uCAA0C;AAC1C,2CAAoD;AACpD,uCAAyD;AAG5C,QAAA,YAAY,GAAG,CAAC,UAAU,EAAE,WAAW,CAAU,CAAC;AAU/D,SAAS,OAAO,CAAC,IAAY,EAAE,SAAiB,EAAE,MAAe;IAC/D,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IACjD,IAAI,MAAM;QAAE,KAAK,CAAC,GAAG,CAAC,gCAAiB,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,GAAG,qBAAS,IAAI,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,MAAM,CACb,IAAY,EACZ,IAAgB,EAChB,IAAY,EACZ,UAA6B,EAAE;IAE/B,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,KAAK,EAAE,IAAI,sBAAU,WAAW,IAAI,QAAQ;QAC5C,WAAW,EAAE,IAAI,sBAAU,WAAW,IAAI,cAAc;QACxD,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAS,eA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AAS,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACrC,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/utils/own.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function deleteOwnKey(path: string): void;
|
|
1
|
+
import type { KeyStore } from "./keys";
|
|
2
|
+
export declare function ownKeyStore(): KeyStore;
|
package/dist/utils/own.js
CHANGED
|
@@ -1,64 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
exports.deleteOwnKey = deleteOwnKey;
|
|
3
|
+
exports.ownKeyStore = ownKeyStore;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
6
5
|
const json_1 = require("./json");
|
|
7
6
|
const registry_1 = require("./registry");
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (const locale of targets) {
|
|
15
|
-
const target = (0, registry_1.getOwnWriteTarget)(locale);
|
|
16
|
-
if (!target)
|
|
17
|
-
continue;
|
|
18
|
-
const isDefault = locale === defaultLocale;
|
|
19
|
-
const hasValue = Object.hasOwn(values, locale);
|
|
20
|
-
const value = values[locale];
|
|
21
|
-
const data = (0, json_1.readJson)(target);
|
|
22
|
-
if (hasValue && (value === null || value === "")) {
|
|
23
|
-
if (isDefault)
|
|
24
|
-
(0, json_1.setAtPath)(data, segments, "");
|
|
25
|
-
else
|
|
26
|
-
(0, json_1.deleteAtPath)(data, segments);
|
|
27
|
-
}
|
|
28
|
-
else if (hasValue) {
|
|
29
|
-
(0, json_1.setAtPath)(data, segments, value);
|
|
30
|
-
}
|
|
31
|
-
else if (isDefault && (0, tree_1.getValueAtPath)(data, path) === undefined) {
|
|
32
|
-
(0, json_1.setAtPath)(data, segments, "");
|
|
33
|
-
}
|
|
34
|
-
(0, json_1.writeJson)(target, data);
|
|
35
|
-
}
|
|
7
|
+
const catalog_1 = require("./catalog");
|
|
8
|
+
function writeTarget(locale) {
|
|
9
|
+
const target = (0, registry_1.getOwnWriteTarget)(locale);
|
|
10
|
+
if (target === null)
|
|
11
|
+
(0, errors_1.fail)("undeclared_locale", { locale }, "no_project_file");
|
|
12
|
+
return target;
|
|
36
13
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (value === undefined)
|
|
47
|
-
continue;
|
|
48
|
-
(0, json_1.deleteAtPath)(data, from);
|
|
49
|
-
(0, json_1.setAtPath)(data, to, value);
|
|
50
|
-
(0, json_1.writeJson)(target, data);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function deleteOwnKey(path) {
|
|
54
|
-
const segments = (0, json_1.validateKeyPath)(path);
|
|
55
|
-
for (const locale of (0, registry_1.getLocaleCodes)("own")) {
|
|
56
|
-
const target = (0, registry_1.getOwnWriteTarget)(locale);
|
|
57
|
-
if (!target)
|
|
58
|
-
continue;
|
|
59
|
-
const data = (0, json_1.readJson)(target);
|
|
60
|
-
(0, json_1.deleteAtPath)(data, segments);
|
|
61
|
-
(0, json_1.writeJson)(target, data);
|
|
62
|
-
}
|
|
14
|
+
function ownKeyStore() {
|
|
15
|
+
return {
|
|
16
|
+
locales: (0, registry_1.getLocaleCodes)("own"),
|
|
17
|
+
baseLocale: (0, catalog_1.projectBaseLocale)(),
|
|
18
|
+
messages: (0, registry_1.loadMessages)("own"),
|
|
19
|
+
reference: (0, registry_1.loadMessages)("external"),
|
|
20
|
+
load: (locale) => (0, json_1.readJsonForWrite)(writeTarget(locale)),
|
|
21
|
+
save: (locale, data) => (0, json_1.writeJson)(writeTarget(locale), data),
|
|
22
|
+
};
|
|
63
23
|
}
|
|
64
24
|
//# sourceMappingURL=own.js.map
|
package/dist/utils/own.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"own.js","sourceRoot":"","sources":["../../src/utils/own.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"own.js","sourceRoot":"","sources":["../../src/utils/own.ts"],"names":[],"mappings":";;AAaA,kCASC;AAtBD,qCAAgC;AAChC,iCAAqD;AAErD,yCAA6E;AAC7E,uCAA8C;AAE9C,SAAS,WAAW,CAAC,MAAc;IACjC,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC,MAAM,CAAC,CAAC;IACzC,IAAI,MAAM,KAAK,IAAI;QAAE,IAAA,aAAI,EAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC;IAC9E,OAAO,MAAM,CAAC;AAChB,CAAC;AAGD,SAAgB,WAAW;IACzB,OAAO;QACL,OAAO,EAAE,IAAA,yBAAc,EAAC,KAAK,CAAC;QAC9B,UAAU,EAAE,IAAA,2BAAiB,GAAE;QAC/B,QAAQ,EAAE,IAAA,uBAAY,EAAC,KAAK,CAAC;QAC7B,SAAS,EAAE,IAAA,uBAAY,EAAC,UAAU,CAAC;QACnC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,uBAAgB,EAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACvD,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,gBAAS,EAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { KeyValueListItem } from "@antelopejs/interface-dms/base/key-value-list";
|
|
2
|
+
import type { BlockItems } from "./blocks";
|
|
3
|
+
import type { WorkspaceSummary } from "./workspaces";
|
|
4
|
+
export declare function publicOrigin(): Promise<string>;
|
|
5
|
+
export type PublicWorkspace = Pick<WorkspaceSummary, "id" | "kind">;
|
|
6
|
+
export declare function publicLocaleUrl(origin: string, workspace: PublicWorkspace, locale?: string): string | undefined;
|
|
7
|
+
export declare function templateUrl(url: string, token: string): string;
|
|
8
|
+
export declare function workspaceEndpoint(workspace: string, origin: string): BlockItems<KeyValueListItem>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.publicOrigin = publicOrigin;
|
|
4
|
+
exports.publicLocaleUrl = publicLocaleUrl;
|
|
5
|
+
exports.templateUrl = templateUrl;
|
|
6
|
+
exports.workspaceEndpoint = workspaceEndpoint;
|
|
7
|
+
const api_base_url_1 = require("@antelopejs/interface-dms/api-base-url");
|
|
8
|
+
const catalog_1 = require("./catalog");
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
const LOCALE_TOKEN = "{locale}";
|
|
11
|
+
const TRAILING_SLASHES_RE = /\/+$/;
|
|
12
|
+
async function publicOrigin() {
|
|
13
|
+
const configured = (await (0, api_base_url_1.GetApiBaseUrl)()) ?? "";
|
|
14
|
+
return configured.replace(TRAILING_SLASHES_RE, "");
|
|
15
|
+
}
|
|
16
|
+
function publicLocaleUrl(origin, workspace, locale = LOCALE_TOKEN) {
|
|
17
|
+
if (workspace.kind !== "added")
|
|
18
|
+
return undefined;
|
|
19
|
+
return `${origin}${constants_1.PUBLIC_PATH}/${workspace.id}/${locale}.json`;
|
|
20
|
+
}
|
|
21
|
+
function templateUrl(url, token) {
|
|
22
|
+
return url.replace(LOCALE_TOKEN, token);
|
|
23
|
+
}
|
|
24
|
+
const LOCAL_ENDPOINTS = {
|
|
25
|
+
default: [
|
|
26
|
+
{
|
|
27
|
+
id: "source",
|
|
28
|
+
label: `$${constants_1.LANG_TEXTS}.endpoint.source_title`,
|
|
29
|
+
value: constants_1.PROJECT_FILES,
|
|
30
|
+
type: "mono",
|
|
31
|
+
copy: true,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "loading",
|
|
35
|
+
label: `$${constants_1.LANG_TEXTS}.endpoint.loading`,
|
|
36
|
+
value: { key: `${constants_1.LANG_TEXTS}.endpoint.loading_default` },
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
modules: [
|
|
40
|
+
{
|
|
41
|
+
id: "source",
|
|
42
|
+
label: `$${constants_1.LANG_TEXTS}.endpoint.source_title`,
|
|
43
|
+
value: { key: `${constants_1.LANG_TEXTS}.workspace_kinds.modules.files` },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "loading",
|
|
47
|
+
label: `$${constants_1.LANG_TEXTS}.endpoint.loading`,
|
|
48
|
+
value: { key: `${constants_1.LANG_TEXTS}.endpoint.loading_modules` },
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
function publicEndpoint(url, base) {
|
|
53
|
+
const example = templateUrl(url, base);
|
|
54
|
+
return [
|
|
55
|
+
{ id: "url", label: "GET", value: url, type: "mono", copy: true },
|
|
56
|
+
{
|
|
57
|
+
id: "example",
|
|
58
|
+
label: `$${constants_1.LANG_TEXTS}.endpoint.example`,
|
|
59
|
+
value: example,
|
|
60
|
+
type: "mono",
|
|
61
|
+
copy: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "fallback",
|
|
65
|
+
label: `$${constants_1.LANG_TEXTS}.endpoint.fallback`,
|
|
66
|
+
value: { key: `${constants_1.LANG_TEXTS}.endpoint.fallback_note` },
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "access",
|
|
70
|
+
label: `$${constants_1.LANG_TEXTS}.endpoint.access`,
|
|
71
|
+
value: { key: `${constants_1.LANG_TEXTS}.endpoint.note` },
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
function workspaceEndpoint(workspace, origin) {
|
|
76
|
+
const summary = (0, catalog_1.findWorkspace)(workspace);
|
|
77
|
+
const url = publicLocaleUrl(origin, summary);
|
|
78
|
+
if (summary.kind !== "added" || !url) {
|
|
79
|
+
return {
|
|
80
|
+
items: LOCAL_ENDPOINTS[summary.kind],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
items: publicEndpoint(url, summary.defaultLocale || catalog_1.FALLBACK_LOCALE),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=public-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-url.js","sourceRoot":"","sources":["../../src/utils/public-url.ts"],"names":[],"mappings":";;AAeA,oCAGC;AAUD,0CAOC;AAGD,kCAEC;AA2DD,8CAcC;AAjHD,yEAAuE;AAGvE,uCAA2D;AAC3D,2CAAqE;AAGrE,MAAM,YAAY,GAAG,UAAU,CAAC;AAChC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAO5B,KAAK,UAAU,YAAY;IAChC,MAAM,UAAU,GAAG,CAAC,MAAM,IAAA,4BAAa,GAAE,CAAC,IAAI,EAAE,CAAC;IACjD,OAAO,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC;AAUD,SAAgB,eAAe,CAC7B,MAAc,EACd,SAA0B,EAC1B,MAAM,GAAG,YAAY;IAErB,IAAI,SAAS,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IACjD,OAAO,GAAG,MAAM,GAAG,uBAAW,IAAI,SAAS,CAAC,EAAE,IAAI,MAAM,OAAO,CAAC;AAClE,CAAC;AAGD,SAAgB,WAAW,CAAC,GAAW,EAAE,KAAa;IACpD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,eAAe,GAGjB;IACF,OAAO,EAAE;QACP;Y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G,sBAAU,gBAAgB,EAAE;SAC9C;KACF,CAAC;AACJ,CAAC;AAGD,SAAgB,iBAAiB,CAC/B,SAAiB,EACjB,MAAc;IAEd,MAAM,OAAO,GAAG,IAAA,uBAAa,EAAC,SAAS,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;QACrC,OAAO;YACL,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,IAAoC,CAAC;SACrE,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,aAAa,IAAI,yBAAe,CAAC;KACrE,CAAC;AACJ,CAAC"}
|
package/dist/utils/registry.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type LocaleMessages } from "./tree";
|
|
2
2
|
export type OriginFilter = "own" | "external";
|
|
3
|
-
|
|
3
|
+
interface RegistryEntry {
|
|
4
4
|
path: string;
|
|
5
5
|
origin: OriginFilter;
|
|
6
6
|
}
|
|
7
7
|
export type I18nRegistry = Record<string, RegistryEntry[]>;
|
|
8
8
|
export declare function initializeLocaleRegistry(): Promise<void>;
|
|
9
|
+
export declare function registryFiles(): string[];
|
|
9
10
|
export declare function loadMessages(origin: OriginFilter): LocaleMessages;
|
|
10
11
|
export declare function getLocaleCodes(origin: OriginFilter): string[];
|
|
11
12
|
export declare function getOwnWriteTarget(localeCode: string): string | null;
|
|
13
|
+
export {};
|
package/dist/utils/registry.js
CHANGED
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initializeLocaleRegistry = initializeLocaleRegistry;
|
|
4
|
+
exports.registryFiles = registryFiles;
|
|
4
5
|
exports.loadMessages = loadMessages;
|
|
5
6
|
exports.getLocaleCodes = getLocaleCodes;
|
|
6
7
|
exports.getOwnWriteTarget = getOwnWriteTarget;
|
|
7
8
|
const page_1 = require("@antelopejs/interface-dms/page");
|
|
9
|
+
const cache_1 = require("./cache");
|
|
8
10
|
const locale_discovery_1 = require("./locale-discovery");
|
|
9
11
|
const json_1 = require("./json");
|
|
10
12
|
const tree_1 = require("./tree");
|
|
11
|
-
let
|
|
13
|
+
let modules = [];
|
|
14
|
+
let directories = [];
|
|
15
|
+
let directoriesStamp = "";
|
|
16
|
+
let registry = {};
|
|
12
17
|
async function initializeLocaleRegistry() {
|
|
13
|
-
|
|
18
|
+
modules = await (0, page_1.GetFrontendModules)();
|
|
19
|
+
scanRegistry();
|
|
14
20
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
21
|
+
function scanRegistry() {
|
|
22
|
+
directories = (0, locale_discovery_1.localeDirectories)(modules);
|
|
23
|
+
directoriesStamp = (0, cache_1.filesStamp)(directories);
|
|
24
|
+
registry = (0, locale_discovery_1.discoverLocaleRegistry)(modules);
|
|
25
|
+
}
|
|
26
|
+
function currentRegistry() {
|
|
27
|
+
if ((0, cache_1.filesStamp)(directories) !== directoriesStamp)
|
|
28
|
+
scanRegistry();
|
|
29
|
+
return registry;
|
|
30
|
+
}
|
|
31
|
+
function registryFiles() {
|
|
32
|
+
return Object.values(currentRegistry()).flatMap((entries) => entries.map((entry) => entry.path));
|
|
17
33
|
}
|
|
18
34
|
function loadMessages(origin) {
|
|
19
|
-
|
|
35
|
+
return (0, cache_1.memoize)(`messages:${origin}`, (0, cache_1.filesStamp)(registryFiles()), () => readMessages(origin));
|
|
36
|
+
}
|
|
37
|
+
function readMessages(origin) {
|
|
20
38
|
const localeMessages = {};
|
|
21
|
-
for (const [localeCode, entries] of Object.entries(
|
|
39
|
+
for (const [localeCode, entries] of Object.entries(currentRegistry())) {
|
|
22
40
|
const files = entries.filter((e) => e.origin === origin);
|
|
23
41
|
if (files.length === 0)
|
|
24
42
|
continue;
|
|
@@ -30,14 +48,12 @@ function loadMessages(origin) {
|
|
|
30
48
|
return localeMessages;
|
|
31
49
|
}
|
|
32
50
|
function getLocaleCodes(origin) {
|
|
33
|
-
|
|
34
|
-
return Object.entries(registry)
|
|
51
|
+
return Object.entries(currentRegistry())
|
|
35
52
|
.filter(([, entries]) => entries.some((e) => e.origin === origin))
|
|
36
53
|
.map(([code]) => code);
|
|
37
54
|
}
|
|
38
55
|
function getOwnWriteTarget(localeCode) {
|
|
39
|
-
const
|
|
40
|
-
const entries = registry[localeCode] ?? [];
|
|
56
|
+
const entries = currentRegistry()[localeCode] ?? [];
|
|
41
57
|
return entries.findLast((e) => e.origin === "own")?.path ?? null;
|
|
42
58
|
}
|
|
43
59
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":";;AA6BA,4DAGC;AAcD,sCAIC;AAGD,oCAIC;AAmBD,wCAIC;AAED,8CAGC;AArFD,yDAGwC;AACxC,mCAA8C;AAC9C,yDAA+E;AAC/E,iCAAkC;AAClC,iCAAwD;AAWxD,IAAI,OAAO,GAA6B,EAAE,CAAC;AAC3C,IAAI,WAAW,GAAa,EAAE,CAAC;AAC/B,IAAI,gBAAgB,GAAG,EAAE,CAAC;AAC1B,IAAI,QAAQ,GAAiB,EAAE,CAAC;AAQzB,KAAK,UAAU,wBAAwB;IAC5C,OAAO,GAAG,MAAM,IAAA,yBAAkB,GAAE,CAAC;IACrC,YAAY,EAAE,CAAC;AACjB,CAAC;AAED,SAAS,YAAY;IACnB,WAAW,GAAG,IAAA,oCAAiB,EAAC,OAAO,CAAC,CAAC;IACzC,gBAAgB,GAAG,IAAA,kBAAU,EAAC,WAAW,CAAC,CAAC;IAC3C,QAAQ,GAAG,IAAA,yCAAsB,EAAC,OAAO,CAAC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SAAgB,cAAc,CAAC,MAAoB;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;SACrC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;SACjE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACpD,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;AACnE,CAAC"}
|
package/dist/utils/resolve.d.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { ALL_WORKSPACE, DEFAULT_WORKSPACE, MODULES_WORKSPACE, type WorkspaceKind, workspaceKind } from "./workspaces";
|
|
3
|
-
export { ALL_WORKSPACE, DEFAULT_WORKSPACE, MODULES_WORKSPACE, type WorkspaceKind, workspaceKind, };
|
|
4
|
-
export interface ByPathResult {
|
|
5
|
-
translations: Record<string, TranslationValue>;
|
|
6
|
-
inherited?: Record<string, TranslationValue>;
|
|
7
|
-
}
|
|
8
|
-
export declare function resolveTranslationData(workspace: string, fallbackDefaultLocale: string): TranslationData;
|
|
9
|
-
export declare function resolveTranslationsByPath(workspace: string, path: string): ByPathResult;
|
|
1
|
+
import { type TranslationValue } from "./tree";
|
|
10
2
|
export interface FlatRow {
|
|
11
3
|
key: string;
|
|
12
4
|
values: Record<string, TranslationValue>;
|
|
13
5
|
inherited?: Record<string, TranslationValue>;
|
|
6
|
+
overridden?: boolean;
|
|
7
|
+
overrides?: Record<string, TranslationValue>;
|
|
8
|
+
outdated?: string[];
|
|
9
|
+
issues?: string[];
|
|
14
10
|
}
|
|
15
|
-
export interface
|
|
16
|
-
defaultLocale: string;
|
|
17
|
-
locales: string[];
|
|
18
|
-
rows: FlatRow[];
|
|
11
|
+
export interface FlatCounts {
|
|
19
12
|
localeProgress: Record<string, number>;
|
|
20
13
|
localeMissing: Record<string, number>;
|
|
21
14
|
totalKeys: number;
|
|
15
|
+
baseMissing: number;
|
|
16
|
+
incompleteKeys: number;
|
|
17
|
+
}
|
|
18
|
+
export interface FlatResult extends FlatCounts {
|
|
19
|
+
defaultLocale: string;
|
|
20
|
+
locales: string[];
|
|
21
|
+
rows: FlatRow[];
|
|
22
22
|
}
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function
|
|
23
|
+
export declare function needsReview(row: FlatRow, locale: string): boolean;
|
|
24
|
+
export declare function isRowMissing(row: FlatRow, locale: string): boolean;
|
|
25
|
+
export declare function resolveFlat(workspace: string): FlatResult;
|
|
26
|
+
export declare function flatCounts(workspace: string): FlatCounts;
|
|
27
|
+
export declare function resolveRow(workspace: string, key: string): FlatRow | undefined;
|