Belgium 🇧🇪
Account created on 10 August 2022, over 2 years ago
#

Merge Requests

More

Recent comments

🇧🇪Belgium arwillame Belgium 🇧🇪

I found an issue with this logic.
I have cases where the result is indeed an array because multiple value are possible, but if there is only one result anyway, i want to keep the same logic as it was multiple.
I think the best would be to just remove the code that makes the "reset($array)" to avoid this issue.
The handling of an array of a single value should not be handled in code but in the field mapping.
I created a new MR for this proposal.

🇧🇪Belgium arwillame Belgium 🇧🇪

Correct, i create a custom_field "Expertise Item field" that have a "firstname" and "lastname" field.
Then i can map then like : firstname => $.*.firstName
This will populate the "Expertise Item field" with multiple items with each have "firstname" and "lastname" filled in.

🇧🇪Belgium arwillame Belgium 🇧🇪

arwillame made their first commit to this issue’s fork.

🇧🇪Belgium arwillame Belgium 🇧🇪

Hi,
I have the same issue and it persists when i list the external entities.
It seems the entity does not have an id when i try to list them.
To avoid that i propose to set the entity id as you do in the "RestClient->save(), but in the externalEntityStorage->mapRawDataToExternalEntities()

Something like this at the end of the method maybe :

   if ($entities[$id]->id() === NULL) {
        $entities[$id]->set('id', $id);
    }
🇧🇪Belgium arwillame Belgium 🇧🇪

Hi,
Thanks for the feedback.
I merged the main branch into my MR and made the requested changes.

🇧🇪Belgium arwillame Belgium 🇧🇪

It seem in certain cases, the media are not copied correctly, still need a bit of work to have a good solution.
Also not a big fan of how the undefinded languages are an exception.
if ($referencedEntity->language()->getId() === LanguageInterface::LANGCODE_NOT_SPECIFIED) {
This is most probably the remaining issue i got.
I'll need a bit more time to work on this.

🇧🇪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.

🇧🇪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 🇧🇪

Hi, Thanks to have reviewed this, i tested it on my issue and it's working fine for me.

🇧🇪Belgium arwillame Belgium 🇧🇪

arwillame created an issue.

🇧🇪Belgium arwillame Belgium 🇧🇪

Hi,
I added the missing schema file in the module.
Best regards.

🇧🇪Belgium arwillame Belgium 🇧🇪

Hi, i made the little change in the schema file.
Best regards.

🇧🇪Belgium arwillame Belgium 🇧🇪

arwillame made their first commit to this issue’s fork.

🇧🇪Belgium arwillame Belgium 🇧🇪

arwillame made their first commit to this issue’s fork.

🇧🇪Belgium arwillame Belgium 🇧🇪

Hi, I just checked the code a bit and test it again.

I think my issue comes because of my data structure.
I have a node with a field that reference a paragraph. Then this paragraph references a bunch of paragraph wich hav they strings fields.

I think the code only check for the string on the first layer of paragraph.

I think we should dive into all possible subparagraphs with a recursive method in https://git.drupalcode.org/project/ai/-/blob/1.0.x/modules/ai_content_su...

🇧🇪Belgium arwillame Belgium 🇧🇪

I Updated my MR ( 395) to integrate the fact that an entity reference can reference an other entity and it has to be translated ortakethe value from the default language as well.

So i created a recursive to go through all the references.
It translate any text that has been found by the extractor and copy any reference from the main language if no translation found.

🇧🇪Belgium arwillame Belgium 🇧🇪

We have the same issue with the entity references.

Example, if a node has an entity reference field that references a paragraph, and that paragraph references a media, the media will not be copied to the translation.

🇧🇪Belgium arwillame Belgium 🇧🇪

At the end it i just added the missing type "webform_flexbox" in the type to ignore

🇧🇪Belgium arwillame Belgium 🇧🇪

with Merge request !395, if no translation found for the entity reference, we just copy the reference value on the translated entity.
This way, image and all other reference from a source language will be ported on the translation.
This feel more natural for editors since the all page looks the same instead of just having only the texts translated.

🇧🇪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.

🇧🇪Belgium arwillame Belgium 🇧🇪

My example contain webform, but i had the same issue with a simple media with file stored in the private part. I was not able to access it neither. So i dont think it's linked to webform.
I had the issue localy as well so i assume it woul not be related to a load balancer issue.

🇧🇪Belgium arwillame Belgium 🇧🇪

I created a MR to add a try -> catch arround the entityReference->save() so in case an error like that occur, the translation still continue and the error is logged as an error in the watchdog.

🇧🇪Belgium arwillame Belgium 🇧🇪

I created a MR that will avoid infinite loop.
The MR add a parameter "Maximum Reference Depth" that allow the user to limit the reference depth.
Default value is set to 1 so it translate only the first referenced element.

Remaining task :
It seem that even if the depth is larger than 1, the system extract correctly all the data but only translate the first level entity.
If the referenced entity reference an other entity again, the second entity will not be translated correctly.
This still need to be fixed.

🇧🇪Belgium arwillame Belgium 🇧🇪

I'm not able to reproduce it anymore.
Maybe the code changes have solved the issue, or an open ai update do not generate that type of content anymore.
I'll close this thicket.

🇧🇪Belgium arwillame Belgium 🇧🇪

I fixed the phpcs et cspell issues.

🇧🇪Belgium arwillame Belgium 🇧🇪

I made more intensive testing and the MR seems fine for me for a "classic" install as specified in my last comment.

For the layout builder configured to be asymmetric (with Layout Builder Asymmetric Translation ), i created a contrib module to handle this case :
https://www.drupal.org/project/ai_translate_lb_asymmetric

With this module, you'll be able to translate you layout builder page with the following config:

- Translatable Fields: Ensure that the fields referencing blocks (layout) are configured to be translatable.
- Non-Translatable Block Fields: Make sure that the block fields themselves are not set to be translatable.

🇧🇪Belgium arwillame Belgium 🇧🇪

I tested as well and it seem to work in the specific default case :
- The content type has a node "layout_builder__layout" wich is NOT TRANSLATABLE
- All the blocks used in Layout builder need to be translatable and have text fields translatable.

So in this configuration it will work as expected, it will just create a translation for the node, where the blocks ids are kept from the source language and translated.

It's the same idea as for the paragraph, this is a "symmetric" setup.

For my use case i would need to be able to have an "asymmetric" translation of the blocks for layout_builder (Dupplicate the block from source language, translate it and attach it to node translation).

I'll work on a module as i made for the asymmetric paragraphs : https://www.drupal.org/project/ai_translate_paragraph_asymetric

🇧🇪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?

🇧🇪Belgium arwillame Belgium 🇧🇪

The issue was in fact linked to the fact we are using revisions in our site.

Inspecting the logic of the content translation controller

I discover that there is a check of the revision to be sure to load the right entity in the right revision.

I added this check in my merge request and it solves my issue.

🇧🇪Belgium arwillame Belgium 🇧🇪

Loading the entity is not working in every cases.
It seems it could be linked to the workflow module. Still investigating.z

🇧🇪Belgium arwillame Belgium 🇧🇪

It is the case, i enabled gitlab ci and the phpcs job runs without issues

🇧🇪Belgium arwillame Belgium 🇧🇪

Thanks for you review,

I updated the .info file to add the missing line.

For the ai_translate_paragraph_asymetric/src/Plugin/FieldTextExtractor/TextFieldParagraphAsymetricExtractor.php not using the right alphabetical order in the "use", i believe it's fine, i had the issue before and it was because my "Drupal/coder" was not up to date.
Maybe you have the same issue?

For the Readme, is it mandatory to have that line size? it seems a bit too small if i respect this.

Plus, it seems to pass the default phpcs in the pipeline.

🇧🇪Belgium arwillame Belgium 🇧🇪

I created a MR where I altered the prompt to explicitly instructs the summarization function to avoid returning the original text or restating it word-for-word. This should lead to more useful and concise summaries.

🇧🇪Belgium arwillame Belgium 🇧🇪

Thanks for your remark, i changed the branch name to 1.0.x

🇧🇪Belgium arwillame Belgium 🇧🇪

I had some issues testing your proposition.
The form configuration do not allowed me to have multiple values in the "entity_autocomplete".

So i created a patch that allow the user to add multiple entities using the "#tags" parameter.
I also add a check to only do that when the related view allow ultiple elements.

Finally i made a little change in the execute method to be able to use the multiple values in the context filter itself.

Please feel free to comment my proposition.

🇧🇪Belgium arwillame Belgium 🇧🇪

I got the same issue, the configuration is well recorded in stabase but i got the main front page on every domain..

I found that in contrib/domain/domain_config/src/DomainConfigOverrider.php

$config_override_exists never goes to TRUE because "$GLOBALS['config']" variable does not include my configurations.

Here is a patch proposal.

Production build 0.71.5 2024