|
|
Background of the issue:
I have an existing WooCommerce webshop with the following plugins installed: Advanced Custom Fields PRO, Advanced Custom Fields Multilingual, WPML Multilingual CMS, and WPML String Translation. Some of the ACF fields are programmed via PHP as per the reference: hidden link. I am trying to translate my WooCommerce ACF (PHP registered) webshop with WPML auto translations. The site is currently under development.
Symptoms:
My flexible fields are not being recognized by WPML. I followed the documentation at https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/setting-the-translation-preferences-for-acf-fields-created-using-php-code/, and tried steps like changing the PHP code, saving an existing page with flexible fields, and attempting to auto-translate in WPML. However, it only recognizes the title.
Questions:
How can I get WPML to recognize and translate my flexible fields?
What steps should I follow to ensure all ACF fields are translated correctly?
|
|
|
Hi,
Thanks for contacting WPML forums support. I'll be glad to help you today.
First of all, sorry for the late reply; it was due to a higher workload.
Please check this page and try the workaround mentioned there.
Kindly let me know if the mentioned workaround fixes the issue.
Best regards,
Osama
|
|
|
Hi Osama,
Thanks for your answer. I only don't really understand how this workaround would help me in this situation.
Currently my ACF fields are not displaying in the custom fields section in my WordPress account because they're built with PHP.
How could I make the transition to using this the fastest? Which steps do I have to take from my current situation? It sounds like a lot of work to get this working on a short notice.
Best regards,
Marvin
|
|
|
Hi Marvin,
Please log in to this hidden link and add your fields code. After that, please let me know how to reproduce the issue so I can consult our compatibility team if we have another workaround.
Best regards,
Osama
|
|
|
Hi Osama,
Thanks for your fast response!
I can log in to the sandbox site, that works good. Only thing is, I don't really see where I have to add the fields code.
I registered it via: acf_add_local_field_group(). So the fields code is living in my theme and registered via functions.php.
Do you want me to share that php file with you? So that your team can find a workaround maybe?
Cheers,
Marvin
|
|
|
Hi Marvin,
Thanks for your reply. Please add the code to the hidden link file on the sandbox site.
You can add it using the file manager plugin or Appearance-> Edit theme files.
Thanks,
Osama
|
|
|
Hi Osama,
Thank you.
I just added my function to register the fields to the functions.php.
Thanks,
Marvin
|
|
|
Hi Marvin,
Thanks for importing the code to the sandbox site. Please check the following steps:
1- Install this hidden link
2- Follow its Usage doc to convert the field groups
3- Go hidden link and check if all groups are imported correctly
4- Edit each group to see if the translation preferences are correct
5- Go hidden link, toggle all group,s and export as JSON
If everything works correctly, you would need to delete the PHP code for the field groups.
Kindly check the result on the sandbox site and let me know if it works as expected.
Best regards,
Osama
|
|
|
Hi Osama,
Great thanks this works! It looks like WPML is recognising my fields and counts the words right now.
Only problem I get now, if I want to start translating using the WPML translation editor it gives me an error with 'File size limit exceeded', 'unable to retrieve job content'.
I hope you can help me further. I already tried this: https://wpml.org/forums/topic/file-size-limit-exceeded-notification/
Thanks,
Marvin
|
|
|
Hi Marvin,
I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
Preferably to a test site where the problem has been replicated.
Your answer will be private, meaning only you and I can access it.
❌ Please backup your database and website ❌
✙ I need your permission to deactivate and reactivate the plugins and themes and change site configurations. This is also why the backup is critical.
✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.
Best regards,
Osama
|
|
|
Hi Marvin,
Thanks for the access details. I installed a local copy of your site and the translation editor opens correctly when I change the theme.
Please change your site's theme to the Twenty-One theme and check if the translation editor will open correctly.
Before translating it, kindly make a minor edit to the page in the default language.
Best regards,
Osama
|
|
|
Hi Osama,
Thank you checking it out!
So far I cannot get it to work yet..
When I make a minor change (nonetheless if it is on the Recnition theme or Twenty-one theme) and try to translate, I don't get to the translation screenl.
Also if I'm in my translation management and try to cancel any Jobs or remove translations nothing is happening but it is only showing errors. Or it says 'The job has been cancelled' while its not being removed.
I have the feeling it is still quite buggy and I'm not getting to the point where I can start auto translating certain pages (thats the reason I purchased the plugin).
I hope you can get me further!
|
|
|
Hi,
Thanks for your update. I created a test site on our testing server to debug the issue further. (hidden link)
On this test site, I updated all the plugins and WordPress core. After that, I changed the translation preferences for the group fields to Same Fields Across Languages to avoid any unwanted content in the translation editor.
However, none of the above didn't fix the issue, so I'll consult our 2nd tier support team and update you as soon as I get their reply.
Best regards,
Osama
|
|
|
Hi,
Thanks for your patience. Our ATE team has found that most of the problematic segments are field labels and choice fields. For example:
trans-unit extradata="Field choices"
resname="acfml-group-7237-field-7244-choices-80ea0b719c7684b31a4c3c34d0c71234"
restype="string" datatype="html"
id="acfml-group-7237-field-7244-choices-80ea0b719c7684b31a4c3c34d0c71234">
<source><![CDATA[ fa-cc]]></source>
<target><![CDATA[ fa-cc]]></target>
</trans-unit>
In order to fix this issue, you need to exclude the field choices and labels from a post-job. (https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/acf-multilingual-acfml-constants-and-hooks-reference/#acfml_exclude_field_group_strings_in_post_jobs)
After adding this line to the wp-config.php:
define( 'ACFML_EXCLUDE_FIELD_GROUP_STRINGS_IN_POST_JOBS', false );
Please update the page in the default language and translate it.
Best regards,
Osama
|
|
|
Hi Osama,
Thanks for your response!
We're coming a bit close I have the feeling, but it is still not working as expected..
Currently there are still some 'jobs' in my translation management. I have the feeling one or a few of those are crooked.
Also the automatic translations queue is stuck, so the translations are not being done atm...
In some cases when I get to the WPML translation page I get error messages.
I've added some screenshots.
I hope we can get started using the translation soon!
Cheers!
|