web-vision / wv_deepltranslate

TYPO3 Extension to translate content and TCA records with DeepL Translate
GNU General Public License v2.0
25 stars 41 forks source link

[FEATURE] Override API key for (sub)pages #356

Open timwehrmann opened 3 weeks ago

timwehrmann commented 3 weeks ago

Is your feature request related to a problem? Please describe. No.

Describe the solution you'd like A customer wants to have the possibility to set an API key per page tree. But not bound to a root page, it is more on subpage tree level. We think that it'd be best to have an (optional) data record that can be placed somewhere in the page tree. On each translation request the rootline has to be gathered and each entry has to be checked if a record is placed there. If so, take the API key from there. If not, take it from extension config.

Describe alternatives you've considered From our point of view the configuration can other take place in TypoScript, in a data record or in a structured file (e.g. YAML) file where you define a pid and a corresponding API key. Since we are in backend context all the time, TypoScript is not the way to go from our point of view. YAML 'd be possible, but is not as flexible as a data record in terms of a deployment.

Additional context We think that the exact location of where to implement the change is either Configuration::getApiKey() or Configuration::__construct(). In both cases we have the information about the page we are translating something. So all we need to do is getting the rootline for that given page and get the information if the API key should be overridden or not. We (as Leuchtfeuer) can provide a patch / PR for that.