- Issue created by @dunx
- 🇬🇧United Kingdom dunx
I played a bit more now and the above delete stuff no longer looks like my screenshots. I'm not a big user of core translate, so I am not overly familiar with how it is supposed to work. I can no longer see the Delete option on unpublished content (clearly shown in the screenshot above) and when I do delete a published translation, it is not deleted.
Regardless... the issue with the initial creation as published remains extant.
- 🇩🇪Germany marcus_johansson
marcus_johansson → changed the visibility of the branch 3494285-translating-unpublished-content to hidden.
- 🇩🇪Germany marcus_johansson
I escalated the issue itself, because its a obvious flaw if it does this. I tested with beta5 and could not replicate the issue. Could you try to update to beta5 and see if you still experience the issue?
- First commit to issue fork.
- 🇧🇬Bulgaria valthebald Sofia
When translated entity implements EntityPublishedInterface, keep the published status from original entity.
- 🇬🇧United Kingdom dunx
I tried to duplicate my original issue on Umami with just the following core and modules enabled:
- Drupal Core 11.1.1 - long list
- Admin Toolbar 3.5.1 - toolbar and extras
- AI (Artificial Intelligence) 1.0.0-beta7 - AI Core and AI Translate
- Key 8.x-1.19
I'm logged in as the admin account.
I created an unpublished article and then clicked on the Translate tab.
I see the following errors:
- Error message - Please set a default chat provider & model in the AI module settings.
- Error message - Warning: Undefined array key 1 in Drupal\ai_translate\Form\AiTranslateForm->buildForm() (line 116 of modules/contrib/ai/modules/ai_translate/src/Form/AiTranslateForm.php).
Stack trace is:
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 431 of core/lib/Drupal/Component/Utility/Html.php). Drupal\Component\Render\FormattableMarkup::placeholderEscape() (Line: 187) Drupal\Component\Render\FormattableMarkup::placeholderFormat() (Line: 195) Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15) Drupal\Core\StringTranslation\TranslatableMarkup->__toString() (Line: 203) Drupal\Core\Utility\LinkGenerator->doGenerate() (Line: 180) Drupal\Core\Utility\LinkGenerator->generate() (Line: 164) Drupal\Core\Link->toString() (Line: 128) Drupal\ai_translate\Form\AiTranslateForm->buildForm() call_user_func_array() (Line: 528) Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279) Drupal\Core\Form\FormBuilder->buildForm() (Line: 219) Drupal\Core\Form\FormBuilder->getForm() (Line: 19) Drupal\ai_translate\Controller\ContentTranslationControllerOverride->overview() call_user_func_array() (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593) Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116) Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90) Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709) Drupal\Core\DrupalKernel->handle() (Line: 19)
I want to use Open AI, but visiting the link displayed under "Default providers" at /en/admin/config/ai/settings to /en/admin/config/ai/providers gives me an access denied error. I am admin.
Ooops... so I'd missed the ai_provider_openai module, but an access denied error doesn't seem very helpful.
I installed and enabled that module.
I added my Open AI key via /en/admin/config/system/keys and configured ai_provider_openai to use that key at /en/admin/config/ai/providers/openaiThat access denied error has gone away :)
I click on the Translate tab again. Same two errors.
Ooops... I haven't configured AI Translate to use Open AI yet.
Dropdown at /en/admin/config/ai/ai-translate says to use the "Default from AI Module (chat)", which is just as well as there's no AI option under "Translate Text" at AI settings (/en/admin/config/ai/settings) which is what I was expecting to have to configure.
So I configure the Chat at that same URL to use Open AI and gpt-3.5-turbo.I click the Translate tab again. Hoorah, no errors.
I click on "Translate using gpt-3.5-turbo" to create a Spanish translation. That works.
But, it's still Published when the original English is Not published.
This feels like a fail to me.
Should I raise the other errors as separate issues?
- 🇧🇬Bulgaria valthebald Sofia
@dunx: You get published translation with applied patch too?
- 🇬🇧United Kingdom dunx
I tested it with
AI (Artificial Intelligence) 1.0.0-beta7
as noted above. I was asked to retest in beta5 at #7. The issue is still present in beta7. The patch is not present in beta7. Shall I apply and retest? - 🇬🇧United Kingdom dunx
After I applied that patch, it worked as expected:
- Created some English content - not published.
- I used the AI translate to Spanish link on the Translate tab.
- That created the Spanish content - also unpublished.
I think that change is ready to go.
- 🇬🇧United Kingdom dunx
I was also able to delete the Spanish translation, which I couldn't do before the patch was applied. I don't think that's strictly related, but an improvement anyway.
- 🇧🇬Bulgaria valthebald Sofia
@dunx, those are exactly the steps to confirm the patch is working, thank you!
I dare move it back to RTBC (I know, formally I shouldn't do it as a patch author, but there was no change in the code, only clarification of the review process) - 🇩🇪Germany marcus_johansson
Sounds good Valery and thanks both, its getting merged.