Skip to content

Commit 98b7567

Browse files
author
awstools
committed
feat(client-translate): Added support for Brevity translation settings feature.
1 parent d6cf665 commit 98b7567

11 files changed

+146
-40
lines changed

Diff for: clients/client-translate/src/commands/CreateParallelDataCommand.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export interface CreateParallelDataCommandOutput extends CreateParallelDataRespo
5151
* Name: "STRING_VALUE", // required
5252
* Description: "STRING_VALUE",
5353
* ParallelDataConfig: { // ParallelDataConfig
54-
* S3Uri: "STRING_VALUE", // required
55-
* Format: "TSV" || "CSV" || "TMX", // required
54+
* S3Uri: "STRING_VALUE",
55+
* Format: "TSV" || "CSV" || "TMX",
5656
* },
5757
* EncryptionKey: { // EncryptionKey
5858
* Type: "KMS", // required

Diff for: clients/client-translate/src/commands/DescribeTextTranslationJobCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export interface DescribeTextTranslationJobCommandOutput extends DescribeTextTra
8888
* // Settings: { // TranslationSettings
8989
* // Formality: "FORMAL" || "INFORMAL",
9090
* // Profanity: "MASK",
91+
* // Brevity: "ON",
9192
* // },
9293
* // },
9394
* // };

Diff for: clients/client-translate/src/commands/GetParallelDataCommand.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export interface GetParallelDataCommandOutput extends GetParallelDataResponse, _
6060
* // "STRING_VALUE",
6161
* // ],
6262
* // ParallelDataConfig: { // ParallelDataConfig
63-
* // S3Uri: "STRING_VALUE", // required
64-
* // Format: "TSV" || "CSV" || "TMX", // required
63+
* // S3Uri: "STRING_VALUE",
64+
* // Format: "TSV" || "CSV" || "TMX",
6565
* // },
6666
* // Message: "STRING_VALUE",
6767
* // ImportedDataSize: Number("long"),

Diff for: clients/client-translate/src/commands/ListParallelDataCommand.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export interface ListParallelDataCommandOutput extends ListParallelDataResponse,
6262
* // "STRING_VALUE",
6363
* // ],
6464
* // ParallelDataConfig: { // ParallelDataConfig
65-
* // S3Uri: "STRING_VALUE", // required
66-
* // Format: "TSV" || "CSV" || "TMX", // required
65+
* // S3Uri: "STRING_VALUE",
66+
* // Format: "TSV" || "CSV" || "TMX",
6767
* // },
6868
* // Message: "STRING_VALUE",
6969
* // ImportedDataSize: Number("long"),

Diff for: clients/client-translate/src/commands/ListTextTranslationJobsCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export interface ListTextTranslationJobsCommandOutput extends ListTextTranslatio
9595
* // Settings: { // TranslationSettings
9696
* // Formality: "FORMAL" || "INFORMAL",
9797
* // Profanity: "MASK",
98+
* // Brevity: "ON",
9899
* // },
99100
* // },
100101
* // ],

Diff for: clients/client-translate/src/commands/StartTextTranslationJobCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export interface StartTextTranslationJobCommandOutput extends StartTextTranslati
8080
* Settings: { // TranslationSettings
8181
* Formality: "FORMAL" || "INFORMAL",
8282
* Profanity: "MASK",
83+
* Brevity: "ON",
8384
* },
8485
* };
8586
* const command = new StartTextTranslationJobCommand(input);

Diff for: clients/client-translate/src/commands/TranslateDocumentCommand.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@ export interface TranslateDocumentCommandOutput extends TranslateDocumentRespons
4343
/**
4444
* @public
4545
* <p>Translates the input document from the source language to the target language.
46-
* This synchronous operation supports plain text or HTML for the input document.
46+
* This synchronous operation supports text, HTML, or Word documents as the input document.
4747
*
4848
* <code>TranslateDocument</code> supports translations from English to any supported language,
4949
* and from any supported language to English. Therefore, specify either the source language code
5050
* or the target language code as “en” (English).
5151
* </p>
52-
* <p>
53-
* <code>TranslateDocument</code> does not support language auto-detection. </p>
5452
* <p> If you set the <code>Formality</code> parameter, the request will fail if the target language does
5553
* not support formality. For a list of target languages that support formality, see
5654
* <a href="https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-formality.html">Setting formality</a>.
@@ -74,6 +72,7 @@ export interface TranslateDocumentCommandOutput extends TranslateDocumentRespons
7472
* Settings: { // TranslationSettings
7573
* Formality: "FORMAL" || "INFORMAL",
7674
* Profanity: "MASK",
75+
* Brevity: "ON",
7776
* },
7877
* };
7978
* const command = new TranslateDocumentCommand(input);
@@ -98,6 +97,7 @@ export interface TranslateDocumentCommandOutput extends TranslateDocumentRespons
9897
* // AppliedSettings: { // TranslationSettings
9998
* // Formality: "FORMAL" || "INFORMAL",
10099
* // Profanity: "MASK",
100+
* // Brevity: "ON",
101101
* // },
102102
* // };
103103
*

Diff for: clients/client-translate/src/commands/TranslateTextCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export interface TranslateTextCommandOutput extends TranslateTextResponse, __Met
5555
* Settings: { // TranslationSettings
5656
* Formality: "FORMAL" || "INFORMAL",
5757
* Profanity: "MASK",
58+
* Brevity: "ON",
5859
* },
5960
* };
6061
* const command = new TranslateTextCommand(input);
@@ -77,6 +78,7 @@ export interface TranslateTextCommandOutput extends TranslateTextResponse, __Met
7778
* // AppliedSettings: { // TranslationSettings
7879
* // Formality: "FORMAL" || "INFORMAL",
7980
* // Profanity: "MASK",
81+
* // Brevity: "ON",
8082
* // },
8183
* // };
8284
*

Diff for: clients/client-translate/src/commands/UpdateParallelDataCommand.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export interface UpdateParallelDataCommandOutput extends UpdateParallelDataRespo
4949
* Name: "STRING_VALUE", // required
5050
* Description: "STRING_VALUE",
5151
* ParallelDataConfig: { // ParallelDataConfig
52-
* S3Uri: "STRING_VALUE", // required
53-
* Format: "TSV" || "CSV" || "TMX", // required
52+
* S3Uri: "STRING_VALUE",
53+
* Format: "TSV" || "CSV" || "TMX",
5454
* },
5555
* ClientToken: "STRING_VALUE", // required
5656
* };

Diff for: clients/client-translate/src/models/models_0.ts

+100-17
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ export interface ParallelDataConfig {
146146
* <p>The URI of the Amazon S3 folder that contains the parallel data input file. The folder
147147
* must be in the same Region as the API endpoint you are calling.</p>
148148
*/
149-
S3Uri: string | undefined;
149+
S3Uri?: string;
150150

151151
/**
152152
* @public
153153
* <p>The format of the parallel data input file.</p>
154154
*/
155-
Format: ParallelDataFormat | undefined;
155+
Format?: ParallelDataFormat;
156156
}
157157

158158
/**
@@ -590,6 +590,19 @@ export interface OutputDataConfig {
590590
EncryptionKey?: EncryptionKey;
591591
}
592592

593+
/**
594+
* @public
595+
* @enum
596+
*/
597+
export const Brevity = {
598+
ON: "ON",
599+
} as const;
600+
601+
/**
602+
* @public
603+
*/
604+
export type Brevity = (typeof Brevity)[keyof typeof Brevity];
605+
593606
/**
594607
* @public
595608
* @enum
@@ -619,13 +632,24 @@ export type Profanity = (typeof Profanity)[keyof typeof Profanity];
619632

620633
/**
621634
* @public
622-
* <p>Settings to configure your translation output, including the option to set the formality
623-
* level of the output text and the option to mask profane words and phrases.</p>
635+
* <p>Settings to configure your translation output. You can configure the following options:</p>
636+
* <ul>
637+
* <li>
638+
* <p>Brevity: reduces the length of the translation output for most translations. Available for
639+
* <code>TranslateText</code> only.</p>
640+
* </li>
641+
* <li>
642+
* <p>Formality: sets the formality level of the translation output.</p>
643+
* </li>
644+
* <li>
645+
* <p>Profanity: masks profane words and phrases in the translation output.</p>
646+
* </li>
647+
* </ul>
624648
*/
625649
export interface TranslationSettings {
626650
/**
627651
* @public
628-
* <p>You can optionally specify the desired level of formality for translations
652+
* <p>You can specify the desired level of formality for translations
629653
* to supported target languages. The formality
630654
* setting controls the level of formal language usage (also known as <a href="https://en.wikipedia.org/wiki/Register_(sociolinguistics)">register</a>) in the
631655
* translation output. You can set the value to informal or formal. If you don't specify a value for
@@ -640,7 +664,7 @@ export interface TranslationSettings {
640664

641665
/**
642666
* @public
643-
* <p>Enable the profanity setting if you want Amazon Translate to mask profane words and
667+
* <p>You can enable the profanity setting if you want to mask profane words and
644668
* phrases in your translation output.</p>
645669
* <p>To mask profane words and phrases, Amazon Translate replaces them with the grawlix string
646670
* “?$#@$“. This 5-character sequence is used for each profane word or phrase, regardless of the
@@ -654,6 +678,18 @@ export interface TranslationSettings {
654678
* language.</p>
655679
*/
656680
Profanity?: Profanity;
681+
682+
/**
683+
* @public
684+
* <p>When you turn on brevity, Amazon Translate reduces the length of the translation output for most translations (when
685+
* compared with the same translation with brevity turned off). By default, brevity is turned
686+
* off.</p>
687+
* <p>If you turn on brevity for a translation request with an unsupported language pair, the
688+
* translation proceeds with the brevity setting turned off.</p>
689+
* <p>For the language pairs that brevity supports, see <a href="https://docs.aws.amazon.com/translate/latest/dg/customizing-translations-brevity">Using brevity</a> in the
690+
* Amazon Translate Developer Guide.</p>
691+
*/
692+
Brevity?: Brevity;
657693
}
658694

659695
/**
@@ -1727,8 +1763,18 @@ export interface StartTextTranslationJobRequest {
17271763

17281764
/**
17291765
* @public
1730-
* <p>Settings to configure your translation output, including the option to set the formality
1731-
* level of the output text and the option to mask profane words and phrases.</p>
1766+
* <p>Settings to configure your translation output. You can configure the following options:</p>
1767+
* <ul>
1768+
* <li>
1769+
* <p>Brevity: not supported.</p>
1770+
* </li>
1771+
* <li>
1772+
* <p>Formality: sets the formality level of the output text.</p>
1773+
* </li>
1774+
* <li>
1775+
* <p>Profanity: masks profane words and phrases in your translation output.</p>
1776+
* </li>
1777+
* </ul>
17321778
*/
17331779
Settings?: TranslationSettings;
17341780
}
@@ -1960,10 +2006,16 @@ export interface TranslateDocumentRequest {
19602006

19612007
/**
19622008
* @public
1963-
* <p>The language code for the language of the source text. Do not use <code>auto</code>, because
1964-
* <code>TranslateDocument</code> does not support language auto-detection.
1965-
* For a list of supported language codes, see
2009+
* <p>The language code for the language of the source text. For a list of supported language codes, see
19662010
* <a href="https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html">Supported languages</a>.</p>
2011+
* <p>To have Amazon Translate determine the source language of your text, you can specify
2012+
* <code>auto</code> in the <code>SourceLanguageCode</code> field. If you specify
2013+
* <code>auto</code>, Amazon Translate will call <a href="https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html">Amazon
2014+
* Comprehend</a> to determine the source language.</p>
2015+
* <note>
2016+
* <p>If you specify <code>auto</code>, you must send the <code>TranslateDocument</code> request in a region that supports
2017+
* Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported. </p>
2018+
* </note>
19672019
*/
19682020
SourceLanguageCode: string | undefined;
19692021

@@ -1977,8 +2029,18 @@ export interface TranslateDocumentRequest {
19772029

19782030
/**
19792031
* @public
1980-
* <p>Settings to configure your translation output, including the option to set the formality
1981-
* level of the output text and the option to mask profane words and phrases.</p>
2032+
* <p>Settings to configure your translation output. You can configure the following options:</p>
2033+
* <ul>
2034+
* <li>
2035+
* <p>Brevity: not supported.</p>
2036+
* </li>
2037+
* <li>
2038+
* <p>Formality: sets the formality level of the output text.</p>
2039+
* </li>
2040+
* <li>
2041+
* <p>Profanity: masks profane words and phrases in your translation output.</p>
2042+
* </li>
2043+
* </ul>
19822044
*/
19832045
Settings?: TranslationSettings;
19842046
}
@@ -2026,8 +2088,19 @@ export interface TranslateDocumentResponse {
20262088

20272089
/**
20282090
* @public
2029-
* <p>Settings to configure your translation output, including the option to set the formality
2030-
* level of the output text and the option to mask profane words and phrases.</p>
2091+
* <p>Settings to configure your translation output. You can configure the following options:</p>
2092+
* <ul>
2093+
* <li>
2094+
* <p>Brevity: reduces the length of the translation output for most translations. Available for
2095+
* <code>TranslateText</code> only.</p>
2096+
* </li>
2097+
* <li>
2098+
* <p>Formality: sets the formality level of the translation output.</p>
2099+
* </li>
2100+
* <li>
2101+
* <p>Profanity: masks profane words and phrases in the translation output.</p>
2102+
* </li>
2103+
* </ul>
20312104
*/
20322105
AppliedSettings?: TranslationSettings;
20332106
}
@@ -2132,8 +2205,18 @@ export interface TranslateTextRequest {
21322205

21332206
/**
21342207
* @public
2135-
* <p>Settings to configure your translation output, including the option to set the formality
2136-
* level of the output text and the option to mask profane words and phrases.</p>
2208+
* <p>Settings to configure your translation output. You can configure the following options:</p>
2209+
* <ul>
2210+
* <li>
2211+
* <p>Brevity: reduces the length of the translated output for most translations.</p>
2212+
* </li>
2213+
* <li>
2214+
* <p>Formality: sets the formality level of the output text.</p>
2215+
* </li>
2216+
* <li>
2217+
* <p>Profanity: masks profane words and phrases in your translation output.</p>
2218+
* </li>
2219+
* </ul>
21372220
*/
21382221
Settings?: TranslationSettings;
21392222
}

0 commit comments

Comments
 (0)