Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 2 voices.

Last updated by Marcos Vinicios Barreto 4 years ago.

Assisted by: Marcos Vinicios Barreto.

Author Posts
May 6, 2021 at 12:41 pm #8704627

joeyT-4

Tell us what you are trying to do?
I'm trying to generate a wpml-config.xml that marks certain repeater subfields as translatable
something like:
<custom-field action="translate">
itbl_customers_cs_*_itbl_customers_cs_results_rows_*_itbl_customers_cs_results_row_title
</custom-field>

The only way I can get it to work is to set actual integers instead of the wildcard but then id need to explode all combinations of integers to capture it.

Is there any documentation that you are following?
I don't understand this: https://wpml.org/documentation/support/language-configuration-files/#2-1-translating-sub-keys-in-custom-fields how would I use that subkeys feature to do this?

Is there a similar example that we can see?

What is the link to your site?

May 7, 2021 at 12:20 am #8709323

Marcos Vinicios Barreto

Hello,

Thank you for contacting our support service. I would like to give a detailed look at your WordPress Dashboard in order to understand what's going on. Usually the wildcard would match all the subfields, so, in your case, I would need to know where the fields are defined and their names, so, I can adjust your code in order to make it work properly in case you have a wrong XML code. For that, please, consider:

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

May 10, 2021 at 5:25 pm #8732227

Marcos Vinicios Barreto

Hello,

Thank you for the updates. I review your settings and noticed the fields are being setup with the Advanced Custom Fields plugin, we have specific instructions to deal with ACF fields you can find at: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/. In your case it seems you are defining the fields using a code approach, in those cases, you would indeed need to register the fields for translation manually by code. Reviewing your code once again, I don't think it is correct, you have the following:

<wpml-config>
    <custom-fields>
        <!-- START: Generated by wpmlConfigUpdate.js -->
        <custom-field action="copy">
            itbl_customers_cs_*_itbl_customers_cs_results_rows_*_itbl_customers_cs_results_row_image
        </custom-field>
    </custom-fields>
</wpml-config>

Here there's no direct reference to which fields should be registered, there's no 'key name' attribute being used, also, the wildcards is not correct, the correct syntax should be something like that:

<wpml-config>

<custom-fields>
    <custom-field action="copy">parent-field-key-name</custom-field>
</custom-fields>
 
<custom-fields-texts>
 <key name="parent-field-key-name">
   <key name="*">
     <key name="attribute-to-be-copied" />
   </key>
 </key>
</custom-fields-texts>
 
</wpml-config>

Please, review our instructions carrefully at: https://wpml.org/documentation/support/language-configuration-files/#custom-fields if you need to keep your manual registration approach and register it accordingly instead of using the script to generate your custom XML code. It is recommended to follow the procedures at: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/ for fields created using ACF as said before.

Please, let me know if it helps, have a nice day.

May 10, 2021 at 6:51 pm #8732563

joeyT-4

Thanks Marcos, I don't really follow. Can you explain how to set the translation preference for this ACF field using the xml config:
itbl_customers_cs_5_itbl_customers_cs_results_rows_0_itbl_customers_cs_results_row_copy

The field name was pulled from here: hidden link -- I can calculate the key from the acf.json hierarchy by concatenating field names -- but can't statically know the integers. I don't understand how the wildcard syntax would work in this case.

Thanks

May 12, 2021 at 8:26 pm #8752183

Marcos Vinicios Barreto

Hello,

Thank you for the updates. I think you are missing some concepts here, at first it always recommended that you register your fields right from the WordPress Dashboard > Custom Fields > Fields Groups exactly as instructed at: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/ this is how you could garantee the correct worflow to define the translation preferences for your fields.

The wildcard syntax wouldn't apply for your particular case (I didn't entirely understand your request previously, this is why I mentioned the XML code approach), instead you can set the preference for these fields right from the post editing screen at the 'Multilingual Content Setup' section. So, no need for XML configuration, just set your translation preference for your field and you should be ready to go. Is there any reason to choose a different workflow?

Hope it brings some more clarifications, have a nice day.

May 13, 2021 at 4:00 am #8753397

joeyT-4

Thanks Marcos,

We use acf.json exclusively to define our acfs so that they can be versioned and deployed as code and kept in sync across all environments. They are not imported into: WordPress Dashboard > Custom Fields > Fields Groups so setting translatability there is not an option. Also setting wpml translation preferences within the acf.json sadly doesn't work.

Going through every post's 'Multilingual Content Setup' would be tough to make sure we found all the custom fields but I guess doable. That leaves the option of setting them all in WPML->Settings->CustomFieldsTranslation which is our last resort. We didn't want to do this because we'd like to be able to deploy our acf configuration and translatability as version controlled files. We have a ruleset that defines (based on field name and type) if it should be translatable or not and wrote a very simple script to generate the wpml.xml to match it. It works perfectly except for subfields / repeaters. If there's a way to target those that'd be great... otherwise I guess we'll devolve back to clicking the translate/copy 3 thousand times and then anytime we modify and acf we must go to prod and set the translation preferences again.

May 14, 2021 at 6:16 pm #8767713

Marcos Vinicios Barreto

Hello,

Thank you for the updates. I understand your points, before asking for a second opinion from our second level suppor team, I would like to give a step further and digging more into this issue. For that, I would appreciate the complete instructions on how to see the code where you are defining your custom fields and also I would need to proceed with a copy of your website, so, I can inspect it without interfering in your website. Please, consider:

To best troubleshoot the issue, please make a snapshot of your site using the Duplicator plugin: https://wordpress.org/plugins/duplicator/. This will allow me to try and duplicate the error so that I can run further tests without interrupting your live site.

Once the snapshot is complete, either upload the snapshot ZIP file and the installer.php file to a file sharing service such as Dropbox (and share the link in your reply) or right click the Duplicator links in your wp-admin and paste in your reply.
Please note: It is important to reduce the size of the package so please exclude some paths like /cache or /uploads and also exclude archives and media files.I will also need the username and password of an account that was created BEFORE creating the duplicator package.I will enable the next reply to be private so only you and I have access to it!

Thank you for your collaboration. Have a nice day.