@parhelia/localization 0.1.12907 → 0.1.12910
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/dist/LocalizeItemCommand.d.ts +7 -1
- package/dist/LocalizeItemCommand.d.ts.map +1 -1
- package/dist/LocalizeItemCommand.js +31 -18
- package/dist/LocalizeItemDialog.d.ts.map +1 -1
- package/dist/LocalizeItemDialog.js +97 -35
- package/dist/LocalizeItemUtils.d.ts +1 -2
- package/dist/LocalizeItemUtils.d.ts.map +1 -1
- package/dist/LocalizeItemUtils.js +78 -36
- package/dist/api/discovery.d.ts +25 -0
- package/dist/api/discovery.d.ts.map +1 -1
- package/dist/api/discovery.js +106 -2
- package/dist/hooks/useTranslationWizard.d.ts.map +1 -1
- package/dist/hooks/useTranslationWizard.js +3 -3
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -32
- package/dist/services/translationService.d.ts +41 -10
- package/dist/services/translationService.d.ts.map +1 -1
- package/dist/services/translationService.js +48 -6
- package/dist/settings/TranslationServicesPanel.d.ts.map +1 -1
- package/dist/settings/TranslationServicesPanel.js +21 -36
- package/dist/setup/LocalizationSetupStep.d.ts.map +1 -1
- package/dist/setup/LocalizationSetupStep.js +29 -18
- package/dist/sidebar/TranslationSidebar.d.ts.map +1 -1
- package/dist/sidebar/TranslationSidebar.js +20 -10
- package/dist/steps/ItemSelectionStep.d.ts +3 -0
- package/dist/steps/ItemSelectionStep.d.ts.map +1 -0
- package/dist/steps/ItemSelectionStep.js +24 -0
- package/dist/steps/ItemSelectionTree.d.ts +13 -0
- package/dist/steps/ItemSelectionTree.d.ts.map +1 -0
- package/dist/steps/ItemSelectionTree.js +327 -0
- package/dist/steps/PromptCustomizationStep.d.ts +1 -1
- package/dist/steps/PromptCustomizationStep.d.ts.map +1 -1
- package/dist/steps/PromptCustomizationStep.js +159 -56
- package/dist/steps/ServiceLanguageSelectionStep.d.ts +6 -1
- package/dist/steps/ServiceLanguageSelectionStep.d.ts.map +1 -1
- package/dist/steps/ServiceLanguageSelectionStep.js +92 -165
- package/dist/steps/WizardStepShell.d.ts +17 -0
- package/dist/steps/WizardStepShell.d.ts.map +1 -0
- package/dist/steps/WizardStepShell.js +11 -0
- package/dist/steps/types.d.ts +17 -1
- package/dist/steps/types.d.ts.map +1 -1
- package/dist/translation-center/TranslationBatches.d.ts +2 -0
- package/dist/translation-center/TranslationBatches.d.ts.map +1 -0
- package/dist/translation-center/TranslationBatches.js +1218 -0
- package/dist/translation-center/TranslationManagement.d.ts.map +1 -1
- package/dist/translation-center/TranslationManagement.js +25 -15
- package/dist/translation-center/TranslationsTitlebar.d.ts +6 -0
- package/dist/translation-center/TranslationsTitlebar.d.ts.map +1 -0
- package/dist/translation-center/TranslationsTitlebar.js +25 -0
- package/dist/translationEvents.d.ts +6 -0
- package/dist/translationEvents.d.ts.map +1 -0
- package/dist/translationEvents.js +4 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/constants.d.ts +0 -15
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -21
- package/dist/steps/MetadataInputStep.d.ts +0 -4
- package/dist/steps/MetadataInputStep.d.ts.map +0 -1
- package/dist/steps/MetadataInputStep.js +0 -41
- package/dist/steps/SubitemDiscoveryStep.d.ts +0 -3
- package/dist/steps/SubitemDiscoveryStep.d.ts.map +0 -1
- package/dist/steps/SubitemDiscoveryStep.js +0 -313
- package/dist/steps/index.d.ts +0 -5
- package/dist/steps/index.d.ts.map +0 -1
- package/dist/steps/index.js +0 -4
- package/dist/translation-center/BatchTranslationView.d.ts +0 -8
- package/dist/translation-center/BatchTranslationView.d.ts.map +0 -1
- package/dist/translation-center/BatchTranslationView.js +0 -870
- package/dist/translation-center/RecentTranslations.d.ts +0 -2
- package/dist/translation-center/RecentTranslations.d.ts.map +0 -1
- package/dist/translation-center/RecentTranslations.js +0 -309
- package/dist/utils/createVersions.d.ts +0 -14
- package/dist/utils/createVersions.d.ts.map +0 -1
- package/dist/utils/createVersions.js +0 -26
package/dist/api/discovery.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { post } from "@parhelia/core";
|
|
2
|
+
export async function suggestBatchName(req, sessionId) {
|
|
3
|
+
const { data, type } = await post("/parhelia/translation/suggestBatchName", {
|
|
4
|
+
ItemIds: req.itemIds,
|
|
5
|
+
TargetLanguages: req.targetLanguages,
|
|
6
|
+
IncludeSubitems: !!req.includeSubitems,
|
|
7
|
+
}, sessionId);
|
|
8
|
+
if (type !== "success")
|
|
9
|
+
return null;
|
|
10
|
+
const name = data?.name?.trim();
|
|
11
|
+
return name && name.length > 0 ? name : null;
|
|
12
|
+
}
|
|
2
13
|
export async function discoverItemsTree(req, sessionId) {
|
|
3
14
|
const { data, type, details } = await post("/parhelia/translation/discoveritemstree", {
|
|
4
15
|
RootItemIds: req.rootItemIds,
|
|
@@ -12,7 +23,15 @@ export function convertBackendTreeToTreeNodes(trees) {
|
|
|
12
23
|
const convert = (n) => ({
|
|
13
24
|
key: n.id,
|
|
14
25
|
label: n.name,
|
|
15
|
-
data: {
|
|
26
|
+
data: {
|
|
27
|
+
id: n.id,
|
|
28
|
+
name: n.name,
|
|
29
|
+
path: n.path,
|
|
30
|
+
isFolder: n.isFolder,
|
|
31
|
+
icon: n.icon,
|
|
32
|
+
parentId: undefined,
|
|
33
|
+
hasChildren: (n.children?.length ?? 0) > 0,
|
|
34
|
+
},
|
|
16
35
|
children: n.children?.map(convert) || [],
|
|
17
36
|
});
|
|
18
37
|
return trees.map(convert);
|
|
@@ -20,9 +39,94 @@ export function convertBackendTreeToTreeNodes(trees) {
|
|
|
20
39
|
export function flattenSelectableItemsFromBackendTrees(trees) {
|
|
21
40
|
const out = [];
|
|
22
41
|
const walk = (n) => {
|
|
23
|
-
out.push({
|
|
42
|
+
out.push({
|
|
43
|
+
id: n.id,
|
|
44
|
+
name: n.name,
|
|
45
|
+
path: n.path,
|
|
46
|
+
hasChildren: (n.children?.length ?? 0) > 0,
|
|
47
|
+
parentId: undefined,
|
|
48
|
+
});
|
|
24
49
|
n.children?.forEach(walk);
|
|
25
50
|
};
|
|
26
51
|
trees.forEach(walk);
|
|
27
52
|
return out;
|
|
28
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Streams the running subitem count for a given root item from the
|
|
56
|
+
* backend. The endpoint returns newline-delimited JSON; each parsed line
|
|
57
|
+
* triggers `onProgress` so the UI can show the count climbing. Filtered
|
|
58
|
+
* server-side via IItemExportFilter + excluded templates.
|
|
59
|
+
*
|
|
60
|
+
* Pass an `AbortSignal` to cancel mid-stream (e.g. user toggles the
|
|
61
|
+
* subitems flag off again).
|
|
62
|
+
*/
|
|
63
|
+
export async function streamSubitemCount(req, onProgress, options) {
|
|
64
|
+
let url = "/parhelia/translation/discoverSubitemCountStream";
|
|
65
|
+
if (options?.sessionId)
|
|
66
|
+
url += "?sessionId=" + options.sessionId;
|
|
67
|
+
const response = await fetch(url, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
body: JSON.stringify({ ItemId: req.itemId, Language: req.language }),
|
|
70
|
+
credentials: "include",
|
|
71
|
+
headers: {
|
|
72
|
+
"Content-Type": "application/json",
|
|
73
|
+
Accept: "application/x-ndjson",
|
|
74
|
+
},
|
|
75
|
+
signal: options?.signal,
|
|
76
|
+
});
|
|
77
|
+
if (!response.ok || !response.body) {
|
|
78
|
+
throw new Error(`Failed to start subitem count stream (${response.status})`);
|
|
79
|
+
}
|
|
80
|
+
const reader = response.body.getReader();
|
|
81
|
+
const decoder = new TextDecoder();
|
|
82
|
+
let buffer = "";
|
|
83
|
+
let lastCount = 0;
|
|
84
|
+
try {
|
|
85
|
+
while (true) {
|
|
86
|
+
const { value, done } = await reader.read();
|
|
87
|
+
if (done)
|
|
88
|
+
break;
|
|
89
|
+
buffer += decoder.decode(value, { stream: true });
|
|
90
|
+
let newlineIndex;
|
|
91
|
+
while ((newlineIndex = buffer.indexOf("\n")) >= 0) {
|
|
92
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
93
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
94
|
+
if (!line)
|
|
95
|
+
continue;
|
|
96
|
+
try {
|
|
97
|
+
const parsed = JSON.parse(line);
|
|
98
|
+
if (typeof parsed.count === "number") {
|
|
99
|
+
lastCount = parsed.count;
|
|
100
|
+
onProgress({ count: parsed.count, complete: !!parsed.complete });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// Ignore malformed line; keep streaming.
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Flush any trailing partial line.
|
|
109
|
+
const tail = buffer.trim();
|
|
110
|
+
if (tail) {
|
|
111
|
+
try {
|
|
112
|
+
const parsed = JSON.parse(tail);
|
|
113
|
+
if (typeof parsed.count === "number") {
|
|
114
|
+
lastCount = parsed.count;
|
|
115
|
+
onProgress({ count: parsed.count, complete: !!parsed.complete });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// Drop malformed trailing data.
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
try {
|
|
125
|
+
reader.releaseLock();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// already released
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return lastCount;
|
|
132
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationWizard.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslationWizard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useTranslationWizard.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslationWizard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAUhF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB;;;EAsGlE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { getLanguagesAndVersions } from "@parhelia/core";
|
|
3
|
-
import { getTranslationStatus, getTranslationProviders } from "../services/translationService";
|
|
3
|
+
import { getTranslationStatus, getTranslationProviders, } from "../services/translationService";
|
|
4
4
|
import { localStorageService } from "@parhelia/core";
|
|
5
5
|
export function useTranslationWizard(props) {
|
|
6
6
|
const [wizardData, setWizardData] = useState({
|
|
@@ -24,7 +24,7 @@ export function useTranslationWizard(props) {
|
|
|
24
24
|
if (providers.length > 0) {
|
|
25
25
|
const savedProvider = localStorageService.getString("editor.translationProvider");
|
|
26
26
|
// Validate that saved provider exists in current providers by name
|
|
27
|
-
const validProvider = savedProvider && providers.find(p => p.name === savedProvider)
|
|
27
|
+
const validProvider = savedProvider && providers.find((p) => p.name === savedProvider)
|
|
28
28
|
? savedProvider
|
|
29
29
|
: providers[0]?.name || "";
|
|
30
30
|
const defaultProvider = validProvider;
|
|
@@ -56,7 +56,7 @@ export function useTranslationWizard(props) {
|
|
|
56
56
|
languageMap.set(language.languageCode, languageData);
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
-
setWizardData(prevData => ({
|
|
59
|
+
setWizardData((prevData) => ({
|
|
60
60
|
...prevData,
|
|
61
61
|
translationProviders: providers,
|
|
62
62
|
translationProvider: defaultProvider,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
+
import { ItemSelectionStep } from "./steps/ItemSelectionStep";
|
|
1
2
|
import { ServiceLanguageSelectionStep } from "./steps/ServiceLanguageSelectionStep";
|
|
2
|
-
import { SubitemDiscoveryStep } from "./steps/SubitemDiscoveryStep";
|
|
3
|
-
import { TranslationWizardData } from "./steps/types";
|
|
4
3
|
import { EditorConfiguration } from "@parhelia/core";
|
|
5
4
|
declare const DEFAULT_TRANSLATION_WIZARD_CONFIGURATION: {
|
|
6
5
|
steps: ({
|
|
7
6
|
id: string;
|
|
8
7
|
name: string;
|
|
9
8
|
description: string;
|
|
10
|
-
component: typeof
|
|
11
|
-
|
|
9
|
+
component: typeof ItemSelectionStep;
|
|
10
|
+
nextButtonLabel?: undefined;
|
|
12
11
|
} | {
|
|
13
12
|
id: string;
|
|
14
13
|
name: string;
|
|
14
|
+
nextButtonLabel: string;
|
|
15
15
|
description: string;
|
|
16
|
-
component: typeof
|
|
17
|
-
skipCondition: (data: TranslationWizardData) => boolean;
|
|
16
|
+
component: typeof ServiceLanguageSelectionStep;
|
|
18
17
|
})[];
|
|
19
18
|
};
|
|
20
19
|
declare const SINGLE_ITEM_TRANSLATION_WIZARD_CONFIGURATION: {
|
|
21
20
|
steps: {
|
|
22
21
|
id: string;
|
|
23
22
|
name: string;
|
|
23
|
+
nextButtonLabel: string;
|
|
24
24
|
description: string;
|
|
25
25
|
component: typeof ServiceLanguageSelectionStep;
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
|
-
export { DEFAULT_TRANSLATION_WIZARD_CONFIGURATION, SINGLE_ITEM_TRANSLATION_WIZARD_CONFIGURATION };
|
|
28
|
+
export { DEFAULT_TRANSLATION_WIZARD_CONFIGURATION, SINGLE_ITEM_TRANSLATION_WIZARD_CONFIGURATION, };
|
|
29
29
|
export { LocalizeItemDialog } from "./LocalizeItemDialog";
|
|
30
30
|
export { localizeItemCommand } from "./LocalizeItemCommand";
|
|
31
31
|
export { TranslationManagement } from "./translation-center/TranslationManagement";
|
|
32
|
-
export {
|
|
33
|
-
export { BatchTranslationView } from "./translation-center/BatchTranslationView";
|
|
32
|
+
export { TranslationBatches } from "./translation-center/TranslationBatches";
|
|
34
33
|
export { LocalizationSetupStep } from "./setup/LocalizationSetupStep";
|
|
35
34
|
export { TranslationServicesPanel } from "./settings/TranslationServicesPanel";
|
|
36
|
-
export type { LocalizeItemCommand, LocalizeItemCommandContext, LocalizeItemCommandData } from "./LocalizeItemCommand";
|
|
37
|
-
export { defaultTranslateAll,
|
|
35
|
+
export type { LocalizeItemCommand, LocalizeItemCommandContext, LocalizeItemCommandData, } from "./LocalizeItemCommand";
|
|
36
|
+
export { defaultTranslateAll, performDefaultTranslation, type StartedTranslation, type TranslationResult, } from "./LocalizeItemUtils";
|
|
38
37
|
export * from "./steps/types";
|
|
39
38
|
export type { TranslationProviderInfo, TranslationStatus } from "./steps/types";
|
|
40
39
|
export type LocalizationConfigOptions = {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAepF,OAAO,EACL,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAUxB,QAAA,MAAM,wCAAwC;;;;;;;;;;;;;;CAuB7C,CAAC;AAEF,QAAA,MAAM,4CAA4C;;;;;;;;CAiBjD,CAAC;AAkCF,OAAO,EACL,wCAAwC,EACxC,4CAA4C,GAC7C,CAAC;AACF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,mBAAmB,EAClC,OAAO,CAAC,EAAE,yBAAyB,uBAyHpC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ItemSelectionStep } from "./steps/ItemSelectionStep";
|
|
2
3
|
import { ServiceLanguageSelectionStep } from "./steps/ServiceLanguageSelectionStep";
|
|
3
|
-
import { SubitemDiscoveryStep } from "./steps/SubitemDiscoveryStep";
|
|
4
4
|
import { PromptCustomizationStep } from "./steps/PromptCustomizationStep";
|
|
5
5
|
import { localizeItemCommand } from "./LocalizeItemCommand";
|
|
6
6
|
import { TranslationSidebar } from "./sidebar/TranslationSidebar";
|
|
7
7
|
import { TranslationManagement } from "./translation-center/TranslationManagement";
|
|
8
|
-
import {
|
|
8
|
+
import { TranslationsTitlebar } from "./translation-center/TranslationsTitlebar";
|
|
9
|
+
import { TranslationBatches } from "./translation-center/TranslationBatches";
|
|
9
10
|
import { TranslationServicesPanel } from "./settings/TranslationServicesPanel";
|
|
10
11
|
import { Languages as LucideLanguages, LayoutGrid as LucideLayoutGrid, Globe as LucideGlobe, } from "lucide-react";
|
|
11
12
|
const LanguagesIcon = LucideLanguages;
|
|
@@ -14,40 +15,43 @@ const GlobeIcon = LucideGlobe;
|
|
|
14
15
|
const DEFAULT_TRANSLATION_WIZARD_CONFIGURATION = {
|
|
15
16
|
steps: [
|
|
16
17
|
{
|
|
17
|
-
id: "
|
|
18
|
-
name: "
|
|
19
|
-
description: "Select
|
|
20
|
-
component:
|
|
18
|
+
id: "item-selection",
|
|
19
|
+
name: "Items",
|
|
20
|
+
description: "Select items to translate.",
|
|
21
|
+
component: ItemSelectionStep,
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
|
-
id: "
|
|
24
|
-
name: "
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
id: "language-selection",
|
|
25
|
+
name: "Languages",
|
|
26
|
+
nextButtonLabel: "Select Languages",
|
|
27
|
+
description: "Select target languages for your content.",
|
|
28
|
+
component: ServiceLanguageSelectionStep,
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
id: "prompt-customization",
|
|
31
|
-
name: "
|
|
32
|
-
|
|
32
|
+
name: "Provider",
|
|
33
|
+
nextButtonLabel: "Select Provider",
|
|
34
|
+
description: "Choose the translation provider and provider settings.",
|
|
33
35
|
component: PromptCustomizationStep,
|
|
34
|
-
skipCondition: (data) => {
|
|
35
|
-
// Skip if custom prompt is not enabled (checkbox unchecked)
|
|
36
|
-
const serviceData = data.serviceCustomData?.get(data.translationProvider);
|
|
37
|
-
return !serviceData || !serviceData.enableCustomPrompt;
|
|
38
|
-
},
|
|
39
36
|
},
|
|
40
37
|
],
|
|
41
38
|
};
|
|
42
39
|
const SINGLE_ITEM_TRANSLATION_WIZARD_CONFIGURATION = {
|
|
43
40
|
steps: [
|
|
44
41
|
{
|
|
45
|
-
id: "
|
|
46
|
-
name: "
|
|
47
|
-
|
|
42
|
+
id: "language-selection",
|
|
43
|
+
name: "Languages",
|
|
44
|
+
nextButtonLabel: "Select Languages",
|
|
45
|
+
description: "Select target languages for your content.",
|
|
48
46
|
component: ServiceLanguageSelectionStep,
|
|
49
47
|
},
|
|
50
|
-
|
|
48
|
+
{
|
|
49
|
+
id: "prompt-customization",
|
|
50
|
+
name: "Provider",
|
|
51
|
+
nextButtonLabel: "Select Provider",
|
|
52
|
+
description: "Choose the translation provider and provider settings.",
|
|
53
|
+
component: PromptCustomizationStep,
|
|
54
|
+
},
|
|
51
55
|
],
|
|
52
56
|
};
|
|
53
57
|
/**
|
|
@@ -76,19 +80,18 @@ const translationManagementWorkspace = {
|
|
|
76
80
|
title: "Translation Management",
|
|
77
81
|
icon: _jsx(GlobeIcon, { strokeWidth: 1 }),
|
|
78
82
|
component: _jsx(TranslationManagement, {}),
|
|
79
|
-
|
|
83
|
+
titlebar: _jsx(TranslationsTitlebar, {}),
|
|
80
84
|
supportsSidebars: false,
|
|
81
85
|
sortOrder: 30,
|
|
82
86
|
};
|
|
83
|
-
export { DEFAULT_TRANSLATION_WIZARD_CONFIGURATION, SINGLE_ITEM_TRANSLATION_WIZARD_CONFIGURATION };
|
|
87
|
+
export { DEFAULT_TRANSLATION_WIZARD_CONFIGURATION, SINGLE_ITEM_TRANSLATION_WIZARD_CONFIGURATION, };
|
|
84
88
|
export { LocalizeItemDialog } from "./LocalizeItemDialog";
|
|
85
89
|
export { localizeItemCommand } from "./LocalizeItemCommand";
|
|
86
90
|
export { TranslationManagement } from "./translation-center/TranslationManagement";
|
|
87
|
-
export {
|
|
88
|
-
export { BatchTranslationView } from "./translation-center/BatchTranslationView";
|
|
91
|
+
export { TranslationBatches } from "./translation-center/TranslationBatches";
|
|
89
92
|
export { LocalizationSetupStep } from "./setup/LocalizationSetupStep";
|
|
90
93
|
export { TranslationServicesPanel } from "./settings/TranslationServicesPanel";
|
|
91
|
-
export { defaultTranslateAll,
|
|
94
|
+
export { defaultTranslateAll, performDefaultTranslation, } from "./LocalizeItemUtils";
|
|
92
95
|
export * from "./steps/types";
|
|
93
96
|
/**
|
|
94
97
|
* Configures the localization extension for the editor.
|
|
@@ -120,7 +123,8 @@ export function configureLocalization(configuration, options) {
|
|
|
120
123
|
configuration.localization = {};
|
|
121
124
|
}
|
|
122
125
|
configuration.localization.multiItem = enableMultiItem;
|
|
123
|
-
configuration.localization.translationManagement =
|
|
126
|
+
configuration.localization.translationManagement =
|
|
127
|
+
enableTranslationManagement;
|
|
124
128
|
if (!configuration.commands.allItemCommands) {
|
|
125
129
|
configuration.commands.allItemCommands = [];
|
|
126
130
|
}
|
|
@@ -147,9 +151,9 @@ export function configureLocalization(configuration, options) {
|
|
|
147
151
|
label: "Translation Status",
|
|
148
152
|
panels: [
|
|
149
153
|
{
|
|
150
|
-
id: "
|
|
151
|
-
label: "
|
|
152
|
-
content: _jsx(
|
|
154
|
+
id: "translation-batches",
|
|
155
|
+
label: "Translation Batches",
|
|
156
|
+
content: _jsx(TranslationBatches, {}),
|
|
153
157
|
},
|
|
154
158
|
],
|
|
155
159
|
},
|
|
@@ -9,7 +9,7 @@ export type TranslationApiResponse<T> = {
|
|
|
9
9
|
export type TranslationRequestResponse = {
|
|
10
10
|
jobId: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId }: {
|
|
12
|
+
export declare function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId, }: {
|
|
13
13
|
itemId: string;
|
|
14
14
|
targetLanguage: string;
|
|
15
15
|
sourceLanguage: string;
|
|
@@ -53,7 +53,8 @@ export type TranslationStructureResponse = {
|
|
|
53
53
|
export declare function getTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<TranslationStructureResponse>>>;
|
|
54
54
|
export declare function ensureTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<TranslationStructureResponse>>>;
|
|
55
55
|
export type TranslationJobRecord = {
|
|
56
|
-
id?:
|
|
56
|
+
id?: string;
|
|
57
|
+
sequenceId?: number;
|
|
57
58
|
itemId: string;
|
|
58
59
|
targetLanguage: string;
|
|
59
60
|
sourceLanguage: string;
|
|
@@ -63,10 +64,17 @@ export type TranslationJobRecord = {
|
|
|
63
64
|
message?: string;
|
|
64
65
|
batchId?: string;
|
|
65
66
|
metadata?: string | null;
|
|
67
|
+
itemName?: string | null;
|
|
68
|
+
itemPath?: string | null;
|
|
69
|
+
workerInstanceId?: string | null;
|
|
70
|
+
claimedAtUtc?: string | null;
|
|
71
|
+
lastHeartbeatUtc?: string | null;
|
|
72
|
+
attemptCount?: number;
|
|
73
|
+
totalCost?: number | null;
|
|
66
74
|
};
|
|
67
75
|
export declare function listBatchTranslationJobs(batchId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationJobRecord[]>>;
|
|
68
76
|
export type TranslationBatchInfo = {
|
|
69
|
-
|
|
77
|
+
id: string;
|
|
70
78
|
createdAtUtc?: string;
|
|
71
79
|
startedAtUtc?: string;
|
|
72
80
|
completedAtUtc?: string;
|
|
@@ -79,10 +87,34 @@ export type TranslationBatchInfo = {
|
|
|
79
87
|
errorJobs?: number;
|
|
80
88
|
metadata?: string | null;
|
|
81
89
|
lastUpdatedUtc?: string;
|
|
90
|
+
totalCost?: number | null;
|
|
82
91
|
exists?: boolean;
|
|
83
92
|
};
|
|
84
93
|
export declare function getBatchInfo(batchId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationBatchInfo>>;
|
|
85
|
-
export
|
|
94
|
+
export type ListBatchesFilters = {
|
|
95
|
+
fromUtc?: string;
|
|
96
|
+
status?: string;
|
|
97
|
+
user?: string;
|
|
98
|
+
provider?: string;
|
|
99
|
+
targetLanguage?: string;
|
|
100
|
+
itemIdOrPath?: string;
|
|
101
|
+
itemIncludeSubitems?: boolean;
|
|
102
|
+
};
|
|
103
|
+
export declare function listBatches(take?: number, skip?: number, filters?: ListBatchesFilters): Promise<import("@parhelia/core").ExecutionResult<TranslationBatchInfo[]>>;
|
|
104
|
+
export type DeleteBatchResponse = {
|
|
105
|
+
success: boolean;
|
|
106
|
+
id: string;
|
|
107
|
+
deletedJobs: number;
|
|
108
|
+
};
|
|
109
|
+
export declare function deleteBatch(id: string): Promise<import("@parhelia/core").ExecutionResult<DeleteBatchResponse>>;
|
|
110
|
+
export type AbortTranslationResponse = {
|
|
111
|
+
success: boolean;
|
|
112
|
+
batchId: string;
|
|
113
|
+
id?: string;
|
|
114
|
+
abortedJobs: number;
|
|
115
|
+
};
|
|
116
|
+
export declare function abortJob(id: string): Promise<import("@parhelia/core").ExecutionResult<AbortTranslationResponse>>;
|
|
117
|
+
export declare function abortBatch(id: string): Promise<import("@parhelia/core").ExecutionResult<AbortTranslationResponse>>;
|
|
86
118
|
export declare function subscribeToBatch(batchId: string, sessionId: string): Promise<import("@parhelia/core").ExecutionResult<{
|
|
87
119
|
success: boolean;
|
|
88
120
|
message: string;
|
|
@@ -106,27 +138,26 @@ export type BatchTranslationError = {
|
|
|
106
138
|
error: string;
|
|
107
139
|
};
|
|
108
140
|
export type BatchTranslationResponse = {
|
|
109
|
-
|
|
141
|
+
id: string;
|
|
110
142
|
started: BatchTranslationResult[];
|
|
111
143
|
skipped: BatchTranslationError[];
|
|
112
144
|
};
|
|
113
|
-
export declare function requestBatchTranslation({ sessionId,
|
|
145
|
+
export declare function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds, }: {
|
|
114
146
|
sessionId: string;
|
|
115
|
-
batchId: string;
|
|
116
147
|
provider: string;
|
|
117
148
|
batchMetadata?: string;
|
|
118
149
|
languageMappings: LanguageMapping[];
|
|
119
150
|
itemIds: string[];
|
|
120
151
|
}): Promise<import("@parhelia/core").ExecutionResult<BatchTranslationResponse>>;
|
|
121
152
|
export type RetryBatchTranslationJobRequest = {
|
|
122
|
-
sourceTranslationId?:
|
|
153
|
+
sourceTranslationId?: string;
|
|
123
154
|
itemId: string;
|
|
124
155
|
sourceLanguage: string;
|
|
125
156
|
targetLanguage: string;
|
|
126
157
|
metadata?: string | null;
|
|
127
158
|
};
|
|
128
159
|
export type RetryBatchTranslationStartedJob = {
|
|
129
|
-
sourceTranslationId?:
|
|
160
|
+
sourceTranslationId?: string;
|
|
130
161
|
itemId: string;
|
|
131
162
|
sourceLanguage: string;
|
|
132
163
|
targetLanguage: string;
|
|
@@ -134,7 +165,7 @@ export type RetryBatchTranslationStartedJob = {
|
|
|
134
165
|
jobId: string;
|
|
135
166
|
};
|
|
136
167
|
export type RetryBatchTranslationSkippedJob = {
|
|
137
|
-
sourceTranslationId?:
|
|
168
|
+
sourceTranslationId?: string;
|
|
138
169
|
itemId: string;
|
|
139
170
|
sourceLanguage: string;
|
|
140
171
|
targetLanguage: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translationService.d.ts","sourceRoot":"","sources":["../../src/services/translationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,wBAAsB,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"translationService.d.ts","sourceRoot":"","sources":["../../src/services/translationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAA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M,+BAA+B,GAAG;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,+BAA+B,EAAE,CAAC;IAC3C,OAAO,EAAE,+BAA+B,EAAE,CAAC;CAC5C,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,SAAS,EACT,aAAa,EACb,QAAQ,EACR,IAAI,GACL,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,+BAA+B,EAAE,CAAC;CACzC,oFAKA"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { get, post } from "@parhelia/core";
|
|
2
|
-
export async function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId }) {
|
|
3
|
-
return await post("/parhelia/translation/requestTranslation", {
|
|
2
|
+
export async function requestTranslation({ itemId, targetLanguage, sourceLanguage, sessionId, provider, metadata, batchId, }) {
|
|
3
|
+
return await post("/parhelia/translation/requestTranslation", {
|
|
4
|
+
itemId,
|
|
5
|
+
targetLanguage,
|
|
6
|
+
sourceLanguage,
|
|
7
|
+
sessionId,
|
|
8
|
+
provider,
|
|
9
|
+
metadata,
|
|
10
|
+
batchId,
|
|
11
|
+
});
|
|
4
12
|
}
|
|
5
13
|
export async function getTranslationStatus(itemId) {
|
|
6
14
|
return await get(`/parhelia/translation/getTranslations?itemId=${itemId}`);
|
|
@@ -44,8 +52,36 @@ export async function listBatchTranslationJobs(batchId) {
|
|
|
44
52
|
export async function getBatchInfo(batchId) {
|
|
45
53
|
return await get(`/parhelia/translation/batchInfo?batchId=${encodeURIComponent(batchId)}`);
|
|
46
54
|
}
|
|
47
|
-
export async function listBatches(take = 100, skip = 0) {
|
|
48
|
-
|
|
55
|
+
export async function listBatches(take = 100, skip = 0, filters = {}) {
|
|
56
|
+
const params = new URLSearchParams();
|
|
57
|
+
params.set("take", String(take));
|
|
58
|
+
params.set("skip", String(skip));
|
|
59
|
+
if (filters.fromUtc)
|
|
60
|
+
params.set("fromUtc", filters.fromUtc);
|
|
61
|
+
if (filters.status)
|
|
62
|
+
params.set("status", filters.status);
|
|
63
|
+
if (filters.user)
|
|
64
|
+
params.set("user", filters.user);
|
|
65
|
+
if (filters.provider)
|
|
66
|
+
params.set("provider", filters.provider);
|
|
67
|
+
if (filters.targetLanguage)
|
|
68
|
+
params.set("targetLanguage", filters.targetLanguage);
|
|
69
|
+
if (filters.itemIdOrPath)
|
|
70
|
+
params.set("itemIdOrPath", filters.itemIdOrPath);
|
|
71
|
+
if (filters.itemIncludeSubitems)
|
|
72
|
+
params.set("itemIncludeSubitems", "true");
|
|
73
|
+
return await get(`/parhelia/translation/batches?${params.toString()}`);
|
|
74
|
+
}
|
|
75
|
+
export async function deleteBatch(id) {
|
|
76
|
+
return await post("/parhelia/translation/deleteBatch", {
|
|
77
|
+
id,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export async function abortJob(id) {
|
|
81
|
+
return await post("/parhelia/translation/abortJob", { id });
|
|
82
|
+
}
|
|
83
|
+
export async function abortBatch(id) {
|
|
84
|
+
return await post("/parhelia/translation/abortBatch", { id });
|
|
49
85
|
}
|
|
50
86
|
export async function subscribeToBatch(batchId, sessionId) {
|
|
51
87
|
return await post("/parhelia/translation/subscribeToBatch", { batchId, sessionId });
|
|
@@ -53,8 +89,14 @@ export async function subscribeToBatch(batchId, sessionId) {
|
|
|
53
89
|
export async function unsubscribeFromBatch(batchId, sessionId) {
|
|
54
90
|
return await post("/parhelia/translation/unsubscribeFromBatch", { batchId, sessionId });
|
|
55
91
|
}
|
|
56
|
-
export async function requestBatchTranslation({ sessionId,
|
|
57
|
-
return await post("/parhelia/translation/requestBatchTranslation", {
|
|
92
|
+
export async function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds, }) {
|
|
93
|
+
return await post("/parhelia/translation/requestBatchTranslation", {
|
|
94
|
+
sessionId,
|
|
95
|
+
provider,
|
|
96
|
+
batchMetadata: batchMetadata || "",
|
|
97
|
+
languageMappings,
|
|
98
|
+
itemIds,
|
|
99
|
+
});
|
|
58
100
|
}
|
|
59
101
|
export async function retryBatchTranslation({ sessionId, sourceBatchId, provider, jobs, }) {
|
|
60
102
|
return await post("/parhelia/translation/retryBatchTranslation", { sessionId, sourceBatchId, provider, jobs });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationServicesPanel.d.ts","sourceRoot":"","sources":["../../src/settings/TranslationServicesPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TranslationServicesPanel.d.ts","sourceRoot":"","sources":["../../src/settings/TranslationServicesPanel.tsx"],"names":[],"mappings":"AAkEA;;;GAGG;AACH,wBAAgB,wBAAwB,4CA4pBvC;AAED,eAAe,wBAAwB,CAAC"}
|