Make several of the API parameters configurable in the provider config

Created on 21 March 2023, almost 2 years ago
Updated 10 April 2023, over 1 year ago

There are a number of optional parameters that the Microsoft Translate API will accept, as documented at https://learn.microsoft.com/en-us/azure/cognitive-services/translator/re..., which the module currently ignores.

I needed to be able to set the Category parameter. But instead of just hard-patching that, I've provided here a patch that adds all* of those optional parameters as configurable options in the TMGMT Microsoft provider configuration form. The request to the API then includes these parameters in its call.

I've attached a screenshot of the updated provider form. The descriptions of the parameters are taken directly out of the documentation linked above, with some minor tweaks to avoid redundancy. The key field at the top is using the key patch I have posted separately in this issue queue, and has no bearing on this patch (you can apply it if you want or not -- I'm only mentioning it now to avoid confusion).

* not quite all fields are in the form. "From" is excluded because it is already being set and not something we would want to change. "Suggested from" is excluded because it will never be used as long as "From" is provided. Additionally worth mentioning is that "textType" was hardcoded in the dev release to "html", and in the stable release to "plain", as of this writing. Now I've included it as an option so it will use whatever is set in the form (defaults to "html").

Default values for these parameters are included with the install config. As such, there shouldn't be any regressions, though if you are applying this patch after already using the module, be sure to visit the provider page and save the settings.

Unlike some of my more recent contributions to this project in the form of patches, this one is definitely aimed at being committed as it should benefit others, with no drawbacks if you don't need the extra params.

📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇨🇦Canada Shiraz Dindar Sooke, BC

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024