[translation] simplify input to translation#19060
[translation] simplify input to translation#19060kristapratico merged 15 commits intoAzure:masterfrom
Conversation
| ) | ||
| ] | ||
| except (AttributeError, TypeError, IndexError): | ||
| raise ValueError("Pass either 'inputs' or 'source_url', 'target_url', and 'target_language_code'") |
There was a problem hiding this comment.
small nit: in the response you can say pass "inputs" for multiple inputs, or these for single
|
|
||
| continuation_token = kwargs.pop("continuation_token", None) | ||
|
|
||
| try: |
There was a problem hiding this comment.
nit: since this code is the same, can you decompose into a helper?
| ) | ||
| ] | ||
| document_translation_client = DocumentTranslationClient("<endpoint>", AzureKeyCredential("<api_key>")) | ||
| poller = document_translation_client.begin_translation("<sas_url_to_source>", "<sas_url_to_target", "fr") |
There was a problem hiding this comment.
nit: do you think it is worth creating a variable language_code="fr" and then use that variable so the user understands what fr is? or maybe just follow the same pattern you have and do <language_code>
There was a problem hiding this comment.
saw we do this in .NET too. If you agree I can create an issue for .NET. If you think it is not important will leave as is :)
There was a problem hiding this comment.
I was trying to demonstrate that these can be passed positionally. I think I'll update to "<target_language_code>" here to be consistent. Thanks for pointing that out!
| source_container_sas_url_en = "<sas-url-en>" | ||
| target_container_sas_url_es = "<sas-url-es>" | ||
| target_container_sas_url_fr = "<sas-url-fr>" | ||
| target_container_sas_url_ar = "<sas-url-fr>" |
There was a problem hiding this comment.
| target_container_sas_url_ar = "<sas-url-fr>" | |
| target_container_sas_url_ar = "<sas-url-ar>" |
Resolves #17916
Waiting on #19041 to merge firstyay

Live tests pass: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=925612&view=results