@wix/auto_sdk_multilingual_machine-translation 1.0.21 → 1.0.22
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/build/cjs/index.d.ts +8 -4
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.ts → index.typings.d.ts} +104 -1
- package/build/cjs/index.typings.js +886 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +2 -1
- package/build/es/index.d.mts +8 -4
- package/build/es/index.mjs.map +1 -1
- package/build/es/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.mts → index.typings.d.mts} +104 -1
- package/build/es/index.typings.mjs +829 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +2 -1
- package/build/internal/cjs/index.d.ts +8 -4
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.ts → index.typings.d.ts} +104 -1
- package/build/internal/cjs/index.typings.js +886 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +2 -1
- package/build/internal/es/index.d.mts +8 -4
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.mts → index.typings.d.mts} +104 -1
- package/build/internal/es/index.typings.mjs +829 -0
- package/build/internal/es/index.typings.mjs.map +1 -0
- package/build/internal/es/meta.d.mts +2 -1
- package/package.json +2 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NonNullablePaths } from '@wix/sdk-types';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A translatable content is a unit of content to translate.
|
|
3
5
|
*
|
|
@@ -1457,6 +1459,8 @@ declare enum NullValue {
|
|
|
1457
1459
|
/** Null value. */
|
|
1458
1460
|
NULL_VALUE = "NULL_VALUE"
|
|
1459
1461
|
}
|
|
1462
|
+
/** @enumType */
|
|
1463
|
+
type NullValueWithLiterals = NullValue | 'NULL_VALUE';
|
|
1460
1464
|
/**
|
|
1461
1465
|
* `ListValue` is a wrapper around a repeated field of values.
|
|
1462
1466
|
*
|
|
@@ -1913,12 +1917,111 @@ interface BulkActionMetadata {
|
|
|
1913
1917
|
/** Number of failures without details because detailed failure threshold was exceeded. */
|
|
1914
1918
|
undetailedFailures?: number;
|
|
1915
1919
|
}
|
|
1920
|
+
type MachineTranslateApplicationErrors = {
|
|
1921
|
+
code?: 'NOT_ENOUGH_CREDITS';
|
|
1922
|
+
description?: string;
|
|
1923
|
+
data?: NotEnoughCreditsError;
|
|
1924
|
+
} | {
|
|
1925
|
+
code?: 'TEXT_TOO_LONG';
|
|
1926
|
+
description?: string;
|
|
1927
|
+
data?: TextTooLongError;
|
|
1928
|
+
} | {
|
|
1929
|
+
code?: 'UNKNOWN_FORMAT';
|
|
1930
|
+
description?: string;
|
|
1931
|
+
data?: UnknownFormatError;
|
|
1932
|
+
} | {
|
|
1933
|
+
code?: 'SAME_LANGUAGE_ARGUMENTS';
|
|
1934
|
+
description?: string;
|
|
1935
|
+
data?: SameLanguageArgumentsError;
|
|
1936
|
+
};
|
|
1937
|
+
type BulkMachineTranslateApplicationErrors = {
|
|
1938
|
+
code?: 'NOT_ENOUGH_CREDITS';
|
|
1939
|
+
description?: string;
|
|
1940
|
+
data?: NotEnoughCreditsError;
|
|
1941
|
+
} | {
|
|
1942
|
+
code?: 'SAME_LANGUAGE_ARGUMENTS';
|
|
1943
|
+
description?: string;
|
|
1944
|
+
data?: SameLanguageArgumentsError;
|
|
1945
|
+
};
|
|
1946
|
+
type TranslatableContentNonNullablePaths = `plainTextContent` | `htmlContent` | `format`;
|
|
1947
|
+
/**
|
|
1948
|
+
* Translates the text of a translatable unit of content from one supported language to another.
|
|
1949
|
+
*
|
|
1950
|
+
* The `translatedContent` object returns with the same `id` used for `contentToTranslate.id` but the text within the
|
|
1951
|
+
* content fields is replaced with the translated text. Note that Wix does not overwrite the original content object.
|
|
1952
|
+
* To retrieve the translated content later, make sure to store it separately.
|
|
1953
|
+
*
|
|
1954
|
+
* Only text content is translated, even if the content is `htmlContent` or `richContent`. Note that [collapsible text](https://support.wix.com/en/article/adding-and-setting-up-collapsible-text)
|
|
1955
|
+
* cannot be translated using this method.
|
|
1956
|
+
*
|
|
1957
|
+
* The translatable content must not exceed 5,000 characters. If this limit is exceeded, the method returns a `TEXT_TOO_LONG` error.
|
|
1958
|
+
* For `richContent`, the 5,000-character limit applies separately to each node in `richContent.nodes`.
|
|
1959
|
+
* The total translatable content may be more than 5,000 characters as long as no individual node surpasses this limit.
|
|
1960
|
+
* If any node exceeds 5,000 characters, the entire request fails.
|
|
1961
|
+
*
|
|
1962
|
+
* Each site has a word credit balance indicating the number of words available for translation. Successful translation requests reduce the word credits by the number of words in `contentToTranslate`.
|
|
1963
|
+
* If the site does not have sufficient word credits to translate all of the text in the request, the request fails
|
|
1964
|
+
* with a `NOT_ENOUGH_CREDITS` error. You can also call the [Credit Data API](https://dev.wix.com/docs/rest/business-management/multilingual/machine-translation/credit-data/introduction)'s [Check Sufficient Credits](https://dev.wix.com/docs/rest/business-management/multilingual/machine-translation/credit-data/check-sufficient-credits) method at any time to check whether the site has enough credits to translate the specified number of words.
|
|
1965
|
+
* Wix users can receive additional word credits by [purchasing a translation package](https://support.wix.com/en/article/wix-multilingual-auto-translating-your-site#purchasing-translation-packages) in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager) at any time.
|
|
1966
|
+
*
|
|
1967
|
+
* To translate up to 1,000 `translatableContent` units at once, use [Bulk Machine Translate](/machine-translation/bulk-machine-translate).
|
|
1968
|
+
* @param sourceLanguage - Language of the source text to translate.
|
|
1969
|
+
* @public
|
|
1970
|
+
* @requiredField options
|
|
1971
|
+
* @requiredField options.contentToTranslate
|
|
1972
|
+
* @requiredField options.targetLanguage
|
|
1973
|
+
* @requiredField sourceLanguage
|
|
1974
|
+
* @permissionId WIX_MULTILINGUAL.MACHINE_TRANSLATE
|
|
1975
|
+
* @applicableIdentity APP
|
|
1976
|
+
* @fqn wix.multilingual.machine.v3.MachineTranslation.MachineTranslate
|
|
1977
|
+
*/
|
|
1978
|
+
declare function machineTranslate(sourceLanguage: SupportedLanguageWithLiterals, options: NonNullablePaths<MachineTranslateOptions, `contentToTranslate` | `targetLanguage`>): Promise<NonNullablePaths<MachineTranslateResponse, {
|
|
1979
|
+
[P in TranslatableContentNonNullablePaths]: `translatedContent.${P}`;
|
|
1980
|
+
}[TranslatableContentNonNullablePaths]> & {
|
|
1981
|
+
__applicationErrorsType?: MachineTranslateApplicationErrors;
|
|
1982
|
+
}>;
|
|
1916
1983
|
interface MachineTranslateOptions {
|
|
1917
1984
|
/** Language to translate text into. */
|
|
1918
1985
|
targetLanguage: SupportedLanguageWithLiterals;
|
|
1919
1986
|
/** The content to translate. */
|
|
1920
1987
|
contentToTranslate: TranslatableContent;
|
|
1921
1988
|
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Translates the text of multiple units of translatable content from one supported language to another.
|
|
1991
|
+
*
|
|
1992
|
+
* Each translated content item in the `results` array returns with the same `id` as the corresponding `contentToTranslate.id`, but with the text in the
|
|
1993
|
+
* content fields replaced with the translated text. Note that Wix does not overwrite the original content source,
|
|
1994
|
+
* to retrieve the translated content later, make sure to store it separately.
|
|
1995
|
+
*
|
|
1996
|
+
* Only text content is translated, even if the content is `htmlContent` or `richContent`. Note that [collapsible text](https://support.wix.com/en/article/adding-and-setting-up-collapsible-text)
|
|
1997
|
+
* cannot be translated using this method.
|
|
1998
|
+
*
|
|
1999
|
+
* Each unit of translatable content must not exceed 5,000 characters. If this limit is exceeded, the method returns a `TEXT_TOO_LONG` error.
|
|
2000
|
+
* For `richContent`, the 5,000-character limit applies separately to each node in `richContent.nodes`.
|
|
2001
|
+
* The total request may exceed 5,000 characters as long as no individual node surpasses this limit.
|
|
2002
|
+
* If any node exceeds 5,000 characters, then the request fails for that specific `contentToTranslate` item and the error details for that
|
|
2003
|
+
* error are returned in `itemMetadata`. Even if some translations fail due to the character limit,
|
|
2004
|
+
* the machine translation for other items will succeed if they are under the character limit.
|
|
2005
|
+
*
|
|
2006
|
+
* Each site has a [word credit](/machine-translation/introduction#terminology) balance, starting at 3,000 words.
|
|
2007
|
+
* Each successful translation request reduces the word credits by the number of words included in `contentToTranslate`.
|
|
2008
|
+
* If the site does not have sufficient word credits to complete the translation, then the entire request fails
|
|
2009
|
+
* with a `NOT_ENOUGH_CREDITS` error. Additional credits can be [purchased through the Dashboard](https://support.wix.com/en/article/wix-multilingual-auto-translating-your-site?tabs=Dashboard-5#purchasing-translation-packages).
|
|
2010
|
+
*
|
|
2011
|
+
* To translate a single unit of `translatableContent`, use [Machine Translate](/machine-translation/machine-translate).
|
|
2012
|
+
* @param sourceLanguage - Language of the source text to translate.
|
|
2013
|
+
* @public
|
|
2014
|
+
* @requiredField options.targetLanguage
|
|
2015
|
+
* @requiredField sourceLanguage
|
|
2016
|
+
* @permissionId WIX_MULTILINGUAL.MACHINE_TRANSLATE
|
|
2017
|
+
* @applicableIdentity APP
|
|
2018
|
+
* @fqn wix.multilingual.machine.v3.MachineTranslation.BulkMachineTranslate
|
|
2019
|
+
*/
|
|
2020
|
+
declare function bulkMachineTranslate(sourceLanguage: SupportedLanguageWithLiterals, options?: NonNullablePaths<BulkMachineTranslateOptions, `targetLanguage`>): Promise<NonNullablePaths<BulkMachineTranslateResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | {
|
|
2021
|
+
[P in TranslatableContentNonNullablePaths]: `results.${number}.item.${P}`;
|
|
2022
|
+
}[TranslatableContentNonNullablePaths] | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`> & {
|
|
2023
|
+
__applicationErrorsType?: BulkMachineTranslateApplicationErrors;
|
|
2024
|
+
}>;
|
|
1922
2025
|
interface BulkMachineTranslateOptions {
|
|
1923
2026
|
/** Language to translate text into. */
|
|
1924
2027
|
targetLanguage: SupportedLanguageWithLiterals;
|
|
@@ -1930,4 +2033,4 @@ interface BulkMachineTranslateOptions {
|
|
|
1930
2033
|
contentToTranslate?: TranslatableContent[];
|
|
1931
2034
|
}
|
|
1932
2035
|
|
|
1933
|
-
export {
|
|
2036
|
+
export { Alignment, type AlignmentWithLiterals, type AnchorData, type AppEmbedData, type AppEmbedDataAppDataOneOf, AppType, type AppTypeWithLiterals, type ApplicationError, type AudioData, type Background, type BackgroundBackgroundOneOf, BackgroundType, type BackgroundTypeWithLiterals, type BlockquoteData, type BookingData, type Border, type BorderColors, type BulkActionMetadata, type BulkMachineTranslateApplicationErrors, type BulkMachineTranslateOptions, type BulkMachineTranslateRequest, type BulkMachineTranslateResponse, type BulkTranslateResult, type BulletedListData, type ButtonData, type CaptionData, type CellStyle, type CodeBlockData, type CollapsibleListData, type ColorData, type Colors, Crop, type CropWithLiterals, type Decoration, type DecorationDataOneOf, DecorationType, type DecorationTypeWithLiterals, type Design, type Dimensions, Direction, type DirectionWithLiterals, type DividerData, type DocumentStyle, type EmbedData, type EventData, type FileData, type FileSource, type FileSourceDataOneOf, type FontSizeData, FontType, type FontTypeWithLiterals, Format, type FormatWithLiterals, type GIF, type GIFData, GIFType, type GIFTypeWithLiterals, type GalleryData, type GalleryOptions, type Gradient, type HTMLData, type HTMLDataDataOneOf, type HeadingData, type Height, type Image, type ImageData, type ImageDataStyles, InitialExpandedItems, type InitialExpandedItemsWithLiterals, type Item, type ItemDataOneOf, type ItemMetadata, type ItemStyle, type Layout, type LayoutCellData, LayoutType, type LayoutTypeWithLiterals, LineStyle, type LineStyleWithLiterals, type Link, type LinkData, type LinkDataOneOf, type LinkPreviewData, type LinkPreviewDataStyles, type ListValue, type MachineTranslateApplicationErrors, type MachineTranslateOptions, type MachineTranslateRequest, type MachineTranslateResponse, type MapData, type MapSettings, MapType, type MapTypeWithLiterals, type Media, type MentionData, type Metadata, type Node, type NodeDataOneOf, type NodeStyle, NodeType, type NodeTypeWithLiterals, type NotEnoughCreditsError, NullValue, type NullValueWithLiterals, type Oembed, type Option, type OptionDesign, type OptionLayout, type OrderedListData, Orientation, type OrientationWithLiterals, type PDFSettings, type ParagraphData, type Permissions, type PlaybackOptions, type PluginContainerData, PluginContainerDataAlignment, type PluginContainerDataAlignmentWithLiterals, type PluginContainerDataWidth, type PluginContainerDataWidthDataOneOf, type Poll, type PollData, type PollDataLayout, type PollDesign, type PollLayout, PollLayoutDirection, type PollLayoutDirectionWithLiterals, PollLayoutType, type PollLayoutTypeWithLiterals, Position, type PositionWithLiterals, type Rel, type RichContent, type SameLanguageArgumentsError, type Settings, Source, type SourceWithLiterals, type Spoiler, type SpoilerData, type Styles, type StylesBorder, SupportedLanguage, type SupportedLanguageWithLiterals, type TableCellData, type TableData, Target, type TargetWithLiterals, TextAlignment, type TextAlignmentWithLiterals, type TextData, type TextNodeStyle, type TextStyle, type TextTooLongError, type Thumbnails, ThumbnailsAlignment, type ThumbnailsAlignmentWithLiterals, type TranslatableContent, type TranslatableContentContentOneOf, Type, type TypeWithLiterals, type UnknownFormatError, VerticalAlignment, type VerticalAlignmentWithLiterals, type Video, type VideoData, ViewMode, type ViewModeWithLiterals, ViewRole, type ViewRoleWithLiterals, VoteRole, type VoteRoleWithLiterals, Width, WidthType, type WidthTypeWithLiterals, type WidthWithLiterals, bulkMachineTranslate, machineTranslate };
|