@parhelia/localization 0.1.12585 → 0.1.12602
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/LocalizeItemDialog.d.ts.map +1 -1
- package/dist/LocalizeItemDialog.js +17 -13
- package/dist/api/discovery.d.ts +4 -1
- package/dist/api/discovery.d.ts.map +1 -1
- package/dist/api/discovery.js +4 -3
- package/dist/hooks/useTranslationWizard.d.ts.map +1 -1
- package/dist/hooks/useTranslationWizard.js +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -13
- package/dist/services/translationService.d.ts +7 -48
- package/dist/services/translationService.d.ts.map +1 -1
- package/dist/services/translationService.js +0 -3
- package/dist/settings/TranslationServicesPanel.d.ts.map +1 -1
- package/dist/settings/TranslationServicesPanel.js +42 -111
- package/dist/setup/LocalizationSetupStep.d.ts.map +1 -1
- package/dist/setup/LocalizationSetupStep.js +7 -8
- package/dist/steps/ServiceLanguageSelectionStep.d.ts.map +1 -1
- package/dist/steps/ServiceLanguageSelectionStep.js +1 -18
- package/dist/steps/SubitemDiscoveryStep.d.ts.map +1 -1
- package/dist/steps/SubitemDiscoveryStep.js +181 -95
- package/dist/translation-center/BatchTranslationView.d.ts +1 -1
- package/dist/translation-center/BatchTranslationView.d.ts.map +1 -1
- package/dist/translation-center/BatchTranslationView.js +98 -356
- package/dist/translation-center/RecentTranslations.d.ts.map +1 -1
- package/dist/translation-center/RecentTranslations.js +13 -20
- package/dist/translation-center/TranslationManagement.d.ts.map +1 -1
- package/dist/translation-center/TranslationManagement.js +4 -2
- package/package.json +11 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizeItemDialog.d.ts","sourceRoot":"","sources":["../src/LocalizeItemDialog.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"LocalizeItemDialog.d.ts","sourceRoot":"","sources":["../src/LocalizeItemDialog.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EAExB,MAAM,eAAe,CAAC;AAqBvB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAAC,uBAAuB,CAAC,2CA6atE"}
|
|
@@ -2,14 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, Button, cn, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@parhelia/core";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { AlertTriangle as LucideAlertTriangle } from "lucide-react";
|
|
5
|
+
import { ChevronRight as LucideChevronRight } from "lucide-react";
|
|
5
6
|
import { useTranslationWizard } from "./hooks/useTranslationWizard";
|
|
6
7
|
import { performDefaultTranslation, generateBatchId } from "./LocalizeItemUtils";
|
|
8
|
+
const ChevronRightIcon = LucideChevronRight;
|
|
7
9
|
const AlertTriangleIcon = LucideAlertTriangle;
|
|
8
10
|
// Threshold for warning about large batch translations
|
|
9
11
|
const LARGE_BATCH_WARNING_THRESHOLD = 100;
|
|
10
12
|
// Note: DialogButtons is an internal component that might need to be added to core exports
|
|
11
13
|
// For now, we'll implement it inline
|
|
12
|
-
const DialogButtons = ({ children, ...props }) => (_jsx("div", { className: "
|
|
14
|
+
const DialogButtons = ({ children, ...props }) => (_jsx("div", { className: "flex justify-end gap-2 pt-4 border-t border-[var(--color-gray-3)] mt-auto px-6 pb-6 bg-background", ...props, children: children }));
|
|
13
15
|
export function LocalizeItemDialog(props) {
|
|
14
16
|
const editContext = props.editContext;
|
|
15
17
|
const configuration = editContext.configuration.translationWizard;
|
|
@@ -220,23 +222,25 @@ export function LocalizeItemDialog(props) {
|
|
|
220
222
|
if (!open) {
|
|
221
223
|
props.onClose?.(null);
|
|
222
224
|
}
|
|
223
|
-
}, children: [_jsxs(DialogContent, { className: "
|
|
224
|
-
width:
|
|
225
|
-
height:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
225
|
+
}, children: [_jsxs(DialogContent, { className: "w-[90vw] max-w-5xl h-[85vh] max-h-[900px] min-h-[700px] overflow-hidden flex flex-col", "data-testid": "translation-wizard-dialog", onPointerDownOutside: (e) => e.preventDefault(), onEscapeKeyDown: (e) => e.preventDefault(), "aria-describedby": "translation-wizard-description", style: {
|
|
226
|
+
width: 'min(90vw, 1280px)',
|
|
227
|
+
height: 'min(85vh, 900px)',
|
|
228
|
+
minHeight: '700px'
|
|
229
|
+
}, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { "data-testid": "translation-wizard-title", children: "Translation Wizard" }), _jsx("div", { id: "translation-wizard-description", className: "sr-only", children: currentStep?.description || "Configure and start translation for your content." })] }), _jsxs("div", { className: "flex flex-1 flex-col min-h-0", children: [_jsx("div", { className: "border-b border-[var(--color-gray-3)] bg-background px-6", "data-testid": "translation-wizard-step-navigation", children: _jsx("div", { className: "flex items-center gap-3 py-3", children: activeSteps.map((step, index) => (_jsxs("div", { className: "flex items-center gap-2", "data-testid": `step-indicator-${step.id}`, children: [_jsx("div", { className: cn("flex h-8 w-8 items-center justify-center rounded-full border text-sm font-medium transition-colors", currentStepIndex === index &&
|
|
230
|
+
"border-[#9650fb] text-[#9650fb] bg-[#f6eeff]", currentStepIndex < index && "border-[var(--color-gray-3)] text-[var(--color-gray-2)]", currentStepIndex > index &&
|
|
231
|
+
"bg-[#9650fb] text-white border-[#9650fb]"), style: currentStepIndex > index
|
|
232
|
+
? { backgroundColor: "#9650fb", color: "#ffffff" }
|
|
233
|
+
: undefined, "data-testid": `step-indicator-circle-${step.id}`, children: currentStepIndex > index ? "✓" : index + 1 }), _jsx("span", { className: cn("text-sm", currentStepIndex === index
|
|
234
|
+
? "text-[#9650fb] font-medium"
|
|
235
|
+
: currentStepIndex > index
|
|
236
|
+
? "text-[#9650fb]"
|
|
237
|
+
: "text-[var(--color-gray-2)]"), "data-testid": `step-indicator-label-${step.id}`, children: step.name }), index < activeSteps.length - 1 && (_jsx(ChevronRightIcon, { className: "w-4 h-4 text-[var(--color-gray-3)] mx-2", strokeWidth: 1 }))] }, step.id))) }) }), _jsx("div", { className: "flex-1 overflow-y-auto min-h-0 bg-[var(--color-gray-5)]", "data-testid": "translation-wizard-step-content", children: _jsx("div", { className: "h-full relative", children: activeSteps.map((step, index) => {
|
|
234
238
|
const StepComponent = step.component;
|
|
235
239
|
const isActive = index === currentStepIndex;
|
|
236
240
|
if (!StepComponent)
|
|
237
241
|
return null;
|
|
238
242
|
return (_jsx("div", { className: "h-full", style: { display: isActive ? 'block' : 'none' }, "aria-hidden": !isActive, "data-testid": `step-content-${step.id}`, children: _jsx(StepComponent, { stepIndex: index, isActive: isActive, data: wizardData, setData: setWizardDataStable, editContext: editContext, onStepCompleted: (completed) => handleStepCompleted(completed, index), setBeforeNextCallback: isActive ? setBeforeNextCallbackStable : undefined, setFooterActions: isActive ? provideFooterActions : undefined, requestClose: isActive ? requestCloseCb : undefined }) }, step.id));
|
|
239
|
-
}) }) }), _jsxs(DialogButtons, { "data-testid": "translation-wizard-dialog-buttons", children: [_jsx(Button, { onClick: () => props.onClose?.(null), variant: "outline", size: "default",
|
|
243
|
+
}) }) }), _jsxs(DialogButtons, { "data-testid": "translation-wizard-dialog-buttons", children: [_jsx(Button, { onClick: () => props.onClose?.(null), variant: "outline", size: "default", "data-testid": "translation-wizard-cancel-button", children: "Cancel" }), currentStepIndex > 0 && (_jsx(Button, { onClick: handlePrevious, variant: "outline", size: "default", "data-testid": "translation-wizard-previous-button", children: "Previous" })), footerActions.map((a) => (_jsx(Button, { onClick: a.onClick, disabled: !!a.disabled, variant: "default", size: "default", "data-testid": `translation-wizard-footer-action-${a.key}`, children: a.label }, a.key))), _jsx(Button, { onClick: handleNext, disabled: !canProceed || isSubmitting, variant: "default", size: "default", "data-testid": "translation-wizard-next-button", children: isSubmitting ? "Starting..." : isLastStep ? "Start Translation" : "Next" })] })] })] }), _jsx(AlertDialog, { open: showLargeBatchWarning, onOpenChange: setShowLargeBatchWarning, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsxs(AlertDialogTitle, { className: "flex items-center gap-2", children: [_jsx(AlertTriangleIcon, { className: "h-5 w-5 text-amber-500" }), "Large Translation Batch"] }), _jsx(AlertDialogDescription, { children: (() => {
|
|
240
244
|
const { itemCount, languageCount, totalTranslations } = calculateTranslationCounts(wizardData);
|
|
241
245
|
return (_jsxs(_Fragment, { children: ["You are about to start ", _jsxs("strong", { children: [totalTranslations, " translations"] }), " (", itemCount, " items \u00D7 ", languageCount, " languages). Large batches may take a significant amount of time to process.", _jsx("br", {}), _jsx("br", {}), "Are you sure you want to continue?"] }));
|
|
242
246
|
})() })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: isSubmitting, children: "Cancel" }), _jsx(AlertDialogAction, { onClick: handleLargeBatchConfirm, disabled: isSubmitting, children: isSubmitting ? "Starting..." : "Continue" })] })] }) })] }));
|
package/dist/api/discovery.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type DiscoveredItem = {
|
|
|
4
4
|
path: string;
|
|
5
5
|
parentId?: string | null;
|
|
6
6
|
hasChildren: boolean;
|
|
7
|
+
hasLayout?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export type TreeNode = {
|
|
9
10
|
key: string;
|
|
@@ -15,6 +16,8 @@ export type BackendTreeNode = {
|
|
|
15
16
|
id: string;
|
|
16
17
|
name: string;
|
|
17
18
|
path: string;
|
|
19
|
+
hasLayout: boolean;
|
|
20
|
+
isTranslatable: boolean;
|
|
18
21
|
isFolder: boolean;
|
|
19
22
|
icon?: string;
|
|
20
23
|
children: BackendTreeNode[];
|
|
@@ -30,5 +33,5 @@ export type DiscoverItemsTreeResponse = {
|
|
|
30
33
|
};
|
|
31
34
|
export declare function discoverItemsTree(req: DiscoverItemsTreeRequest, sessionId?: string): Promise<DiscoverItemsTreeResponse>;
|
|
32
35
|
export declare function convertBackendTreeToTreeNodes(trees: BackendTreeNode[]): TreeNode[];
|
|
33
|
-
export declare function
|
|
36
|
+
export declare function flattenPagesFromBackendTrees(trees: BackendTreeNode[]): DiscoveredItem[];
|
|
34
37
|
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC;AAInG,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,wBAAwB,EAC7B,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,yBAAyB,CAAC,CAWpC;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,QAAQ,EAAE,CAQlF;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,cAAc,EAAE,CAQvF"}
|
package/dist/api/discovery.js
CHANGED
|
@@ -12,15 +12,16 @@ export function convertBackendTreeToTreeNodes(trees) {
|
|
|
12
12
|
const convert = (n) => ({
|
|
13
13
|
key: n.id,
|
|
14
14
|
label: n.name,
|
|
15
|
-
data: { id: n.id, name: n.name, path: n.path,
|
|
15
|
+
data: { id: n.id, name: n.name, path: n.path, hasLayout: n.hasLayout, isTranslatable: n.isTranslatable, icon: n.icon, parentId: undefined, hasChildren: (n.children?.length ?? 0) > 0 },
|
|
16
16
|
children: n.children?.map(convert) || [],
|
|
17
17
|
});
|
|
18
18
|
return trees.map(convert);
|
|
19
19
|
}
|
|
20
|
-
export function
|
|
20
|
+
export function flattenPagesFromBackendTrees(trees) {
|
|
21
21
|
const out = [];
|
|
22
22
|
const walk = (n) => {
|
|
23
|
-
|
|
23
|
+
if (n.isTranslatable)
|
|
24
|
+
out.push({ id: n.id, name: n.name, path: n.path, hasChildren: (n.children?.length ?? 0) > 0, parentId: undefined });
|
|
24
25
|
n.children?.forEach(walk);
|
|
25
26
|
};
|
|
26
27
|
trees.forEach(walk);
|
|
@@ -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;AAMhF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB;;;EA8FlE"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { getLanguagesAndVersions } from "@parhelia/core";
|
|
3
3
|
import { getTranslationStatus, getTranslationProviders } from "../services/translationService";
|
|
4
|
-
import { localStorageService } from "@parhelia/core";
|
|
5
4
|
export function useTranslationWizard(props) {
|
|
6
5
|
const [wizardData, setWizardData] = useState({
|
|
7
6
|
items: props.items,
|
|
@@ -22,7 +21,7 @@ export function useTranslationWizard(props) {
|
|
|
22
21
|
const providersResult = await getTranslationProviders();
|
|
23
22
|
const providers = providersResult.data || [];
|
|
24
23
|
if (providers.length > 0) {
|
|
25
|
-
const savedProvider =
|
|
24
|
+
const savedProvider = localStorage.getItem("editor.translationProvider");
|
|
26
25
|
// Validate that saved provider exists in current providers by name
|
|
27
26
|
const validProvider = savedProvider && providers.find(p => p.name === savedProvider)
|
|
28
27
|
? savedProvider
|
|
@@ -69,7 +68,7 @@ export function useTranslationWizard(props) {
|
|
|
69
68
|
// Save translation provider to localStorage when it changes
|
|
70
69
|
useEffect(() => {
|
|
71
70
|
if (wizardData.translationProvider) {
|
|
72
|
-
|
|
71
|
+
localStorage.setItem("editor.translationProvider", wizardData.translationProvider);
|
|
73
72
|
}
|
|
74
73
|
}, [wizardData.translationProvider]);
|
|
75
74
|
return {
|
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,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAatD,OAAO,EACL,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAUxB,QAAA,MAAM,wCAAwC;;;;;;;;;;;;8BAalB,qBAAqB;;CAchD,CAAC;AAEF,QAAA,MAAM,4CAA4C;;;;;;;CAUjD,CAAC;AAkCF,OAAO,EAAE,wCAAwC,EAAE,4CAA4C,EAAE,CAAC;AAClG,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,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,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,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACz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AqC,CAAC;AAC/E,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,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,uBAsIpC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { localizeItemCommand } from "./LocalizeItemCommand";
|
|
|
6
6
|
import { TranslationSidebar } from "./sidebar/TranslationSidebar";
|
|
7
7
|
import { TranslationManagement } from "./translation-center/TranslationManagement";
|
|
8
8
|
import { RecentTranslations } from "./translation-center/RecentTranslations";
|
|
9
|
+
import { LocalizationSetupStep } from "./setup/LocalizationSetupStep";
|
|
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;
|
|
@@ -109,6 +110,15 @@ export * from "./steps/types";
|
|
|
109
110
|
export function configureLocalization(configuration, options) {
|
|
110
111
|
const enableMultiItem = options?.multiItem !== false; // Default to true
|
|
111
112
|
const enableTranslationManagement = options?.translationManagement !== false; // Default to true
|
|
113
|
+
// Add localization setup step
|
|
114
|
+
if (!configuration.setup) {
|
|
115
|
+
configuration.setup = { steps: [] };
|
|
116
|
+
}
|
|
117
|
+
// Check if the step is already added (to prevent duplicates)
|
|
118
|
+
const hasLocalizationSetup = configuration.setup.steps.some((step) => step === LocalizationSetupStep || step.name === "LocalizationSetupStep");
|
|
119
|
+
if (!hasLocalizationSetup) {
|
|
120
|
+
configuration.setup.steps.push(LocalizationSetupStep);
|
|
121
|
+
}
|
|
112
122
|
// Initialize the translation wizard configuration if it doesn't exist
|
|
113
123
|
if (!configuration.translationWizard) {
|
|
114
124
|
configuration.translationWizard = enableMultiItem
|
|
@@ -178,30 +188,35 @@ export function configureLocalization(configuration, options) {
|
|
|
178
188
|
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
179
189
|
content: _jsx(TranslationServicesPanel, {}),
|
|
180
190
|
};
|
|
181
|
-
const ensureLocalizationPanels = (group) => {
|
|
182
|
-
if (!group.panels.some((p) => p.id === "translation-services")) {
|
|
183
|
-
group.panels.push(translationServicesPanel);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
191
|
if (localizationGroupIndex >= 0) {
|
|
192
|
+
// Group exists, check if panel is already added
|
|
187
193
|
const group = configuration.settings.groups[localizationGroupIndex];
|
|
188
194
|
if (group) {
|
|
189
|
-
|
|
195
|
+
const hasPanel = group.panels.some((p) => p.id === "translation-services");
|
|
196
|
+
if (!hasPanel) {
|
|
197
|
+
group.panels.push(translationServicesPanel);
|
|
198
|
+
}
|
|
190
199
|
}
|
|
191
200
|
}
|
|
192
201
|
else {
|
|
202
|
+
// Group doesn't exist, create it
|
|
193
203
|
const groups = configuration.settings.groups;
|
|
194
204
|
const aboutIndex = groups.findIndex((g) => g.title === "About");
|
|
195
|
-
const localizationGroup = {
|
|
196
|
-
title: "Localization",
|
|
197
|
-
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
198
|
-
panels: [translationServicesPanel],
|
|
199
|
-
};
|
|
200
205
|
if (aboutIndex >= 0) {
|
|
201
|
-
|
|
206
|
+
// Insert before About section
|
|
207
|
+
groups.splice(aboutIndex, 0, {
|
|
208
|
+
title: "Localization",
|
|
209
|
+
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
210
|
+
panels: [translationServicesPanel],
|
|
211
|
+
});
|
|
202
212
|
}
|
|
203
213
|
else {
|
|
204
|
-
|
|
214
|
+
// No About section found, push to end
|
|
215
|
+
groups.push({
|
|
216
|
+
title: "Localization",
|
|
217
|
+
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
218
|
+
panels: [translationServicesPanel],
|
|
219
|
+
});
|
|
205
220
|
}
|
|
206
221
|
}
|
|
207
222
|
return configuration;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { TranslationStatus } from "../types";
|
|
2
2
|
import { TranslationProviderInfo } from "../steps/types";
|
|
3
|
-
export type TranslationApiResponse<T> = {
|
|
4
|
-
success: boolean;
|
|
5
|
-
data?: T;
|
|
6
|
-
error?: string;
|
|
7
|
-
message?: string;
|
|
8
|
-
};
|
|
9
3
|
export type TranslationRequestResponse = {
|
|
10
4
|
jobId: string;
|
|
11
5
|
};
|
|
@@ -29,11 +23,13 @@ export type AvailableTranslationService = {
|
|
|
29
23
|
templateId: string;
|
|
30
24
|
templateName: string;
|
|
31
25
|
};
|
|
32
|
-
export declare function getAvailableTranslationServices(): Promise<import("@parhelia/core").ExecutionResult<
|
|
33
|
-
export declare function createProviderSettings(serviceName: string, templateId: string, language?: string, structureSettings?: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<
|
|
26
|
+
export declare function getAvailableTranslationServices(): Promise<import("@parhelia/core").ExecutionResult<AvailableTranslationService[]>>;
|
|
27
|
+
export declare function createProviderSettings(serviceName: string, templateId: string, language?: string, structureSettings?: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<{
|
|
28
|
+
success: boolean;
|
|
34
29
|
itemId: string;
|
|
35
30
|
itemPath: string;
|
|
36
|
-
|
|
31
|
+
message: string;
|
|
32
|
+
}>>;
|
|
37
33
|
export type TranslationStructureSettings = {
|
|
38
34
|
translationFolderPath: string;
|
|
39
35
|
translationFolderTemplateId: string;
|
|
@@ -50,10 +46,9 @@ export type TranslationStructureResponse = {
|
|
|
50
46
|
translationFolder: TranslationStructureItemInfo;
|
|
51
47
|
translationProvidersFolder: TranslationStructureItemInfo;
|
|
52
48
|
};
|
|
53
|
-
export declare function getTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<
|
|
54
|
-
export declare function ensureTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<
|
|
49
|
+
export declare function getTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationStructureResponse>>;
|
|
50
|
+
export declare function ensureTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationStructureResponse>>;
|
|
55
51
|
export type TranslationJobRecord = {
|
|
56
|
-
id?: number;
|
|
57
52
|
itemId: string;
|
|
58
53
|
targetLanguage: string;
|
|
59
54
|
sourceLanguage: string;
|
|
@@ -62,7 +57,6 @@ export type TranslationJobRecord = {
|
|
|
62
57
|
hash?: string;
|
|
63
58
|
message?: string;
|
|
64
59
|
batchId?: string;
|
|
65
|
-
metadata?: string | null;
|
|
66
60
|
};
|
|
67
61
|
export declare function listBatchTranslationJobs(batchId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationJobRecord[]>>;
|
|
68
62
|
export type TranslationBatchInfo = {
|
|
@@ -118,39 +112,4 @@ export declare function requestBatchTranslation({ sessionId, batchId, provider,
|
|
|
118
112
|
languageMappings: LanguageMapping[];
|
|
119
113
|
itemIds: string[];
|
|
120
114
|
}): Promise<import("@parhelia/core").ExecutionResult<BatchTranslationResponse>>;
|
|
121
|
-
export type RetryBatchTranslationJobRequest = {
|
|
122
|
-
sourceTranslationId?: number;
|
|
123
|
-
itemId: string;
|
|
124
|
-
sourceLanguage: string;
|
|
125
|
-
targetLanguage: string;
|
|
126
|
-
metadata?: string | null;
|
|
127
|
-
};
|
|
128
|
-
export type RetryBatchTranslationStartedJob = {
|
|
129
|
-
sourceTranslationId?: number;
|
|
130
|
-
itemId: string;
|
|
131
|
-
sourceLanguage: string;
|
|
132
|
-
targetLanguage: string;
|
|
133
|
-
metadata?: string | null;
|
|
134
|
-
jobId: string;
|
|
135
|
-
};
|
|
136
|
-
export type RetryBatchTranslationSkippedJob = {
|
|
137
|
-
sourceTranslationId?: number;
|
|
138
|
-
itemId: string;
|
|
139
|
-
sourceLanguage: string;
|
|
140
|
-
targetLanguage: string;
|
|
141
|
-
error: string;
|
|
142
|
-
};
|
|
143
|
-
export type RetryBatchTranslationResponse = {
|
|
144
|
-
sourceBatchId: string;
|
|
145
|
-
retryBatchId: string;
|
|
146
|
-
provider: string;
|
|
147
|
-
started: RetryBatchTranslationStartedJob[];
|
|
148
|
-
skipped: RetryBatchTranslationSkippedJob[];
|
|
149
|
-
};
|
|
150
|
-
export declare function retryBatchTranslation({ sessionId, sourceBatchId, provider, jobs, }: {
|
|
151
|
-
sessionId: string;
|
|
152
|
-
sourceBatchId: string;
|
|
153
|
-
provider?: string;
|
|
154
|
-
jobs: RetryBatchTranslationJobRequest[];
|
|
155
|
-
}): Promise<import("@parhelia/core").ExecutionResult<RetryBatchTranslationResponse>>;
|
|
156
115
|
//# sourceMappingURL=translationService.d.ts.map
|
|
@@ -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,
|
|
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,gBAA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|
|
@@ -56,6 +56,3 @@ export async function unsubscribeFromBatch(batchId, sessionId) {
|
|
|
56
56
|
export async function requestBatchTranslation({ sessionId, batchId, provider, batchMetadata, languageMappings, itemIds }) {
|
|
57
57
|
return await post("/parhelia/translation/requestBatchTranslation", { sessionId, batchId, provider, batchMetadata: batchMetadata || "", languageMappings, itemIds });
|
|
58
58
|
}
|
|
59
|
-
export async function retryBatchTranslation({ sessionId, sourceBatchId, provider, jobs, }) {
|
|
60
|
-
return await post("/parhelia/translation/retryBatchTranslation", { sessionId, sourceBatchId, provider, jobs });
|
|
61
|
-
}
|
|
@@ -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":"AAgDA;;;GAGG;AACH,wBAAgB,wBAAwB,4CAggBvC;AAED,eAAe,wBAAwB,CAAC"}
|