Skip to content

Commit 46e4239

Browse files
MikeyMCZMichal Materna
andauthored
[Text Translation] Rename the from_parameter (#35729)
* [Text Translation] Update the from_parameter * Switch to prod typespec --------- Co-authored-by: Michal Materna <[email protected]>
1 parent c4984e6 commit 46e4239

17 files changed

+182
-182
lines changed

sdk/translation/azure-ai-translation-text/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ Returns equivalent words for the source term in the target language.
255255

256256
```python
257257
try:
258-
from_parameter = "en"
258+
from_language = "en"
259259
to = "es"
260260
input_text_elements = ["fly"]
261261

262262
response = text_translator.lookup_dictionary_entries(
263-
body=input_text_elements, from_parameter=from_parameter, to=to
263+
body=input_text_elements, from_language=from_language, to=to
264264
)
265265
dictionary_entry = response[0] if response else None
266266

@@ -291,12 +291,12 @@ Returns grammatical structure and context examples for the source term and targe
291291

292292
```python
293293
try:
294-
from_parameter = "en"
294+
from_language = "en"
295295
to = "es"
296296
input_text_elements = [DictionaryExampleTextItem(text="fly", translation="volar")]
297297

298298
response = text_translator.lookup_dictionary_examples(
299-
body=input_text_elements, from_parameter=from_parameter, to=to
299+
body=input_text_elements, from_language=from_language, to=to
300300
)
301301
dictionary_entry = response[0] if response else None
302302

sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_operations/_operations.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def build_text_translation_translate_request(
8686
*,
8787
to: List[str],
8888
client_trace_id: Optional[str] = None,
89-
from_parameter: Optional[str] = None,
89+
from_language: Optional[str] = None,
9090
text_type: Optional[Union[str, _models.TextType]] = None,
9191
category: Optional[str] = None,
9292
profanity_action: Optional[Union[str, _models.ProfanityAction]] = None,
@@ -111,8 +111,8 @@ def build_text_translation_translate_request(
111111

112112
# Construct parameters
113113
_params["to"] = [_SERIALIZER.query("to", q, "str") if q is not None else "" for q in to]
114-
if from_parameter is not None:
115-
_params["from"] = _SERIALIZER.query("from_parameter", from_parameter, "str")
114+
if from_language is not None:
115+
_params["from"] = _SERIALIZER.query("from_language", from_language, "str")
116116
if text_type is not None:
117117
_params["textType"] = _SERIALIZER.query("text_type", text_type, "str")
118118
if category is not None:
@@ -209,7 +209,7 @@ def build_text_translation_find_sentence_boundaries_request( # pylint: disable=
209209

210210

211211
def build_text_translation_lookup_dictionary_entries_request( # pylint: disable=name-too-long
212-
*, from_parameter: str, to: str, client_trace_id: Optional[str] = None, **kwargs: Any
212+
*, from_language: str, to: str, client_trace_id: Optional[str] = None, **kwargs: Any
213213
) -> HttpRequest:
214214
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
215215
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
@@ -222,7 +222,7 @@ def build_text_translation_lookup_dictionary_entries_request( # pylint: disable
222222
_url = "/dictionary/lookup"
223223

224224
# Construct parameters
225-
_params["from"] = _SERIALIZER.query("from_parameter", from_parameter, "str")
225+
_params["from"] = _SERIALIZER.query("from_language", from_language, "str")
226226
_params["to"] = _SERIALIZER.query("to", to, "str")
227227
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
228228

@@ -237,7 +237,7 @@ def build_text_translation_lookup_dictionary_entries_request( # pylint: disable
237237

238238

239239
def build_text_translation_lookup_dictionary_examples_request( # pylint: disable=name-too-long
240-
*, from_parameter: str, to: str, client_trace_id: Optional[str] = None, **kwargs: Any
240+
*, from_language: str, to: str, client_trace_id: Optional[str] = None, **kwargs: Any
241241
) -> HttpRequest:
242242
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
243243
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
@@ -250,7 +250,7 @@ def build_text_translation_lookup_dictionary_examples_request( # pylint: disabl
250250
_url = "/dictionary/examples"
251251

252252
# Construct parameters
253-
_params["from"] = _SERIALIZER.query("from_parameter", from_parameter, "str")
253+
_params["from"] = _SERIALIZER.query("from_language", from_language, "str")
254254
_params["to"] = _SERIALIZER.query("to", to, "str")
255255
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
256256

@@ -462,7 +462,7 @@ def translate(
462462
*,
463463
to: List[str],
464464
client_trace_id: Optional[str] = None,
465-
from_parameter: Optional[str] = None,
465+
from_language: Optional[str] = None,
466466
text_type: Optional[Union[str, _models.TextType]] = None,
467467
category: Optional[str] = None,
468468
profanity_action: Optional[Union[str, _models.ProfanityAction]] = None,
@@ -493,7 +493,7 @@ def translate(
493493
:keyword client_trace_id: A client-generated GUID to uniquely identify the request. Default
494494
value is None.
495495
:paramtype client_trace_id: str
496-
:keyword from_parameter: Specifies the language of the input text. Find which languages are
496+
:keyword from_language: Specifies the language of the input text. Find which languages are
497497
available to translate from by
498498
looking up supported languages using the translation scope. If the from parameter isn't
499499
specified,
@@ -502,7 +502,7 @@ def translate(
502502
You must use the from parameter rather than autodetection when using the dynamic dictionary
503503
feature.
504504
Note: the dynamic dictionary feature is case-sensitive. Default value is None.
505-
:paramtype from_parameter: str
505+
:paramtype from_language: str
506506
:keyword text_type: Defines whether the text being translated is plain text or HTML text. Any
507507
HTML needs to be a well-formed,
508508
complete element. Possible values are: plain (default) or html. Known values are: "Plain" and
@@ -638,7 +638,7 @@ def translate(
638638
*,
639639
to: List[str],
640640
client_trace_id: Optional[str] = None,
641-
from_parameter: Optional[str] = None,
641+
from_language: Optional[str] = None,
642642
text_type: Optional[Union[str, _models.TextType]] = None,
643643
category: Optional[str] = None,
644644
profanity_action: Optional[Union[str, _models.ProfanityAction]] = None,
@@ -669,7 +669,7 @@ def translate(
669669
:keyword client_trace_id: A client-generated GUID to uniquely identify the request. Default
670670
value is None.
671671
:paramtype client_trace_id: str
672-
:keyword from_parameter: Specifies the language of the input text. Find which languages are
672+
:keyword from_language: Specifies the language of the input text. Find which languages are
673673
available to translate from by
674674
looking up supported languages using the translation scope. If the from parameter isn't
675675
specified,
@@ -678,7 +678,7 @@ def translate(
678678
You must use the from parameter rather than autodetection when using the dynamic dictionary
679679
feature.
680680
Note: the dynamic dictionary feature is case-sensitive. Default value is None.
681-
:paramtype from_parameter: str
681+
:paramtype from_language: str
682682
:keyword text_type: Defines whether the text being translated is plain text or HTML text. Any
683683
HTML needs to be a well-formed,
684684
complete element. Possible values are: plain (default) or html. Known values are: "Plain" and
@@ -807,7 +807,7 @@ def translate(
807807
*,
808808
to: List[str],
809809
client_trace_id: Optional[str] = None,
810-
from_parameter: Optional[str] = None,
810+
from_language: Optional[str] = None,
811811
text_type: Optional[Union[str, _models.TextType]] = None,
812812
category: Optional[str] = None,
813813
profanity_action: Optional[Union[str, _models.ProfanityAction]] = None,
@@ -838,7 +838,7 @@ def translate(
838838
:keyword client_trace_id: A client-generated GUID to uniquely identify the request. Default
839839
value is None.
840840
:paramtype client_trace_id: str
841-
:keyword from_parameter: Specifies the language of the input text. Find which languages are
841+
:keyword from_language: Specifies the language of the input text. Find which languages are
842842
available to translate from by
843843
looking up supported languages using the translation scope. If the from parameter isn't
844844
specified,
@@ -847,7 +847,7 @@ def translate(
847847
You must use the from parameter rather than autodetection when using the dynamic dictionary
848848
feature.
849849
Note: the dynamic dictionary feature is case-sensitive. Default value is None.
850-
:paramtype from_parameter: str
850+
:paramtype from_language: str
851851
:keyword text_type: Defines whether the text being translated is plain text or HTML text. Any
852852
HTML needs to be a well-formed,
853853
complete element. Possible values are: plain (default) or html. Known values are: "Plain" and
@@ -989,7 +989,7 @@ def translate(
989989
_request = build_text_translation_translate_request(
990990
to=to,
991991
client_trace_id=client_trace_id,
992-
from_parameter=from_parameter,
992+
from_language=from_language,
993993
text_type=text_type,
994994
category=category,
995995
profanity_action=profanity_action,
@@ -1514,7 +1514,7 @@ def lookup_dictionary_entries(
15141514
self,
15151515
body: List[_models.InputTextItem],
15161516
*,
1517-
from_parameter: str,
1517+
from_language: str,
15181518
to: str,
15191519
client_trace_id: Optional[str] = None,
15201520
content_type: str = "application/json",
@@ -1527,10 +1527,10 @@ def lookup_dictionary_entries(
15271527
15281528
:param body: Defines the content of the request. Required.
15291529
:type body: list[~azure.ai.translation.text.models.InputTextItem]
1530-
:keyword from_parameter: Specifies the language of the input text.
1530+
:keyword from_language: Specifies the language of the input text.
15311531
The source language must be one of the supported languages included in the dictionary scope.
15321532
Required.
1533-
:paramtype from_parameter: str
1533+
:paramtype from_language: str
15341534
:keyword to: Specifies the language of the output text.
15351535
The target language must be one of the supported languages included in the dictionary scope.
15361536
Required.
@@ -1629,7 +1629,7 @@ def lookup_dictionary_entries(
16291629
self,
16301630
body: IO[bytes],
16311631
*,
1632-
from_parameter: str,
1632+
from_language: str,
16331633
to: str,
16341634
client_trace_id: Optional[str] = None,
16351635
content_type: str = "application/json",
@@ -1642,10 +1642,10 @@ def lookup_dictionary_entries(
16421642
16431643
:param body: Defines the content of the request. Required.
16441644
:type body: IO[bytes]
1645-
:keyword from_parameter: Specifies the language of the input text.
1645+
:keyword from_language: Specifies the language of the input text.
16461646
The source language must be one of the supported languages included in the dictionary scope.
16471647
Required.
1648-
:paramtype from_parameter: str
1648+
:paramtype from_language: str
16491649
:keyword to: Specifies the language of the output text.
16501650
The target language must be one of the supported languages included in the dictionary scope.
16511651
Required.
@@ -1737,7 +1737,7 @@ def lookup_dictionary_entries(
17371737
self,
17381738
body: Union[List[_models.InputTextItem], IO[bytes]],
17391739
*,
1740-
from_parameter: str,
1740+
from_language: str,
17411741
to: str,
17421742
client_trace_id: Optional[str] = None,
17431743
**kwargs: Any
@@ -1750,10 +1750,10 @@ def lookup_dictionary_entries(
17501750
:param body: Defines the content of the request. Is either a [InputTextItem] type or a
17511751
IO[bytes] type. Required.
17521752
:type body: list[~azure.ai.translation.text.models.InputTextItem] or IO[bytes]
1753-
:keyword from_parameter: Specifies the language of the input text.
1753+
:keyword from_language: Specifies the language of the input text.
17541754
The source language must be one of the supported languages included in the dictionary scope.
17551755
Required.
1756-
:paramtype from_parameter: str
1756+
:paramtype from_language: str
17571757
:keyword to: Specifies the language of the output text.
17581758
The target language must be one of the supported languages included in the dictionary scope.
17591759
Required.
@@ -1858,7 +1858,7 @@ def lookup_dictionary_entries(
18581858
_content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
18591859

18601860
_request = build_text_translation_lookup_dictionary_entries_request(
1861-
from_parameter=from_parameter,
1861+
from_language=from_language,
18621862
to=to,
18631863
client_trace_id=client_trace_id,
18641864
content_type=content_type,
@@ -1904,7 +1904,7 @@ def lookup_dictionary_examples(
19041904
self,
19051905
body: List[_models.DictionaryExampleTextItem],
19061906
*,
1907-
from_parameter: str,
1907+
from_language: str,
19081908
to: str,
19091909
client_trace_id: Optional[str] = None,
19101910
content_type: str = "application/json",
@@ -1917,10 +1917,10 @@ def lookup_dictionary_examples(
19171917
19181918
:param body: Defines the content of the request. Required.
19191919
:type body: list[~azure.ai.translation.text.models.DictionaryExampleTextItem]
1920-
:keyword from_parameter: Specifies the language of the input text.
1920+
:keyword from_language: Specifies the language of the input text.
19211921
The source language must be one of the supported languages included in the dictionary scope.
19221922
Required.
1923-
:paramtype from_parameter: str
1923+
:paramtype from_language: str
19241924
:keyword to: Specifies the language of the output text.
19251925
The target language must be one of the supported languages included in the dictionary scope.
19261926
Required.
@@ -1991,7 +1991,7 @@ def lookup_dictionary_examples(
19911991
self,
19921992
body: IO[bytes],
19931993
*,
1994-
from_parameter: str,
1994+
from_language: str,
19951995
to: str,
19961996
client_trace_id: Optional[str] = None,
19971997
content_type: str = "application/json",
@@ -2004,10 +2004,10 @@ def lookup_dictionary_examples(
20042004
20052005
:param body: Defines the content of the request. Required.
20062006
:type body: IO[bytes]
2007-
:keyword from_parameter: Specifies the language of the input text.
2007+
:keyword from_language: Specifies the language of the input text.
20082008
The source language must be one of the supported languages included in the dictionary scope.
20092009
Required.
2010-
:paramtype from_parameter: str
2010+
:paramtype from_language: str
20112011
:keyword to: Specifies the language of the output text.
20122012
The target language must be one of the supported languages included in the dictionary scope.
20132013
Required.
@@ -2066,7 +2066,7 @@ def lookup_dictionary_examples(
20662066
self,
20672067
body: Union[List[_models.DictionaryExampleTextItem], IO[bytes]],
20682068
*,
2069-
from_parameter: str,
2069+
from_language: str,
20702070
to: str,
20712071
client_trace_id: Optional[str] = None,
20722072
**kwargs: Any
@@ -2079,10 +2079,10 @@ def lookup_dictionary_examples(
20792079
:param body: Defines the content of the request. Is either a [DictionaryExampleTextItem] type
20802080
or a IO[bytes] type. Required.
20812081
:type body: list[~azure.ai.translation.text.models.DictionaryExampleTextItem] or IO[bytes]
2082-
:keyword from_parameter: Specifies the language of the input text.
2082+
:keyword from_language: Specifies the language of the input text.
20832083
The source language must be one of the supported languages included in the dictionary scope.
20842084
Required.
2085-
:paramtype from_parameter: str
2085+
:paramtype from_language: str
20862086
:keyword to: Specifies the language of the output text.
20872087
The target language must be one of the supported languages included in the dictionary scope.
20882088
Required.
@@ -2154,7 +2154,7 @@ def lookup_dictionary_examples(
21542154
_content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
21552155

21562156
_request = build_text_translation_lookup_dictionary_examples_request(
2157-
from_parameter=from_parameter,
2157+
from_language=from_language,
21582158
to=to,
21592159
client_trace_id=client_trace_id,
21602160
content_type=content_type,

0 commit comments

Comments
 (0)