- Issue created by @arwillame
- 🇧🇪Belgium arwillame Belgium 🇧🇪
Handle the "allowed_languages" module as well in the last commit of the MR.
I would prefer to use a more global method to fiw this but i dont for now.
If anyone has a better approach? - First commit to issue fork.
- Merge request !378Rework controller to use whatever controller it has replaced as the structure... → (Merged) created by MrDaleSmith
- 🇬🇧United Kingdom MrDaleSmith
@arwillame I've tried an alternate approach in the new branch - what this *should* do is use whatever controller exists at that route to build the original template and then add the AI Translate info to it: that way, we don't need to hardcode module names and risk missing one.
It's available at https://git.drupalcode.org/project/ai/-/merge_requests/378. We could do with some people using modules tat already override that translate route to test and see if it works as expected.
- 🇧🇪Belgium arwillame Belgium 🇧🇪
I, Thanks for the the idea, it seems nice indeed.
I made a quick check with one project where language_access module is used.
First it just did not seemed to work, so i updated the weight .
Then i had a php error when testing it :TypeError: array_splice(): Argument #1 ($array) must be of type array, null given in array_splice() (regel 177 van /var/www/html/web/modules/contrib/ai/modules/ai_translate/src/Form/AiTranslateForm.php).
So i would say it would need a bit more of testing/work.
- First commit to issue fork.
- 🇬🇧United Kingdom seogow
I have tested the '3480861-translate-with-ai-retake' branch with the following setup:
- Drupal 11.1.1
- drupal/language_access:^2.0
- drupal/ai:dev-3480861-translate-with-ai-retake as 1.0.x-dev (corresponds to commit 7fd2b16335c78caba729ade3454f04cd963460ab, above ai:1.0.2)
- Modules enabled: content_translation, ai, ai_provider_openai, ai_translate, key, language_access
Result:
- No Watchdog issues.
- Language access prevents access to language versions user has no access to.
- AI translations column contains translation link at '/node/{nid}/translations'.
- A translation is made when link is clicked.
@arwillame can you provide description how to replicate the error you observed?
- 🇬🇧United Kingdom MrDaleSmith
Yeah line 177 for me in the 3480861-translate-with-ai-retake branch is the start of a comment - it looks like you may be using a version of the code that doesn't have the
if (isset($option['data'])) {
line? This section of the form isn't actually edited in the MR just moved inside an additional if. I also don't need to adjust the weight of the routing change - allowed_languages is set to -220 and the MR to -230. All works for me.
- 🇧🇪Belgium arwillame Belgium 🇧🇪
Hi, merged the last version of the code and tested it again and it seem to be working fine for me now !
Thanks for your contribution on this issue ! - 🇧🇪Belgium arwillame Belgium 🇧🇪
Side node, i still need to change the weight as it is in MR.
I believe it's because otherwhise "language_access" module take the lead on the route and dont take this one into account. - Status changed to RTBC
5 days ago 9:16am 17 February 2025 - 🇬🇧United Kingdom MrDaleSmith
I suspect that will be different on every installation so I'm not sure there's a lot can be done about it, unless we have a maxikmum weight we can use?