Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
Unable to translate acf checkboxes labels.

Solution:
1. Navigate to ACF->Tools and enable the option 'Scan local fields for changes to translation preferences.' and save the changes.
2. Go to WPML->Strings Translations->Auto Register strings for translations and enable the 'Look for strings while pages are rendered' option.
3. Visit the page on the front-end where the string is shown to automatically register strings from that page.
4. Return to WPML->Strings Translations->Auto Register strings for translations and disable the previously enabled options.
5. Search for the strings in WPML->String Translations and translate all instances that appear.

If this solution does not seem relevant to your issue, please open a new support ticket with us.

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.

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by Shekhar Bhandari 1 year, 6 months ago.

Assisted by: Shekhar Bhandari.

Author Posts
December 7, 2023 at 8:04 pm #15020905

johnM-108

I've attached an image of screenshots with notes that you can follow along with. Note that this is a multisite environment, but this question only involves the main site of the multisite environment.

================
Original English Page
hidden link

If you scroll down on this page, you'll encounter a section with a heading of "Divisions". I want this section to show the translated versions of the labels (e.g. Corporate Services).

================
ACF Field Group

In the second panel of the attached image, you'll see the Advanced Custom Fields (ACF) field group that handles this data (acf-field-group-69). You'll see the "Division" field is a checkbox and the Choices section contains the value:label pairs.

================
WPML String Translation

In the third panel of the attached image, you'll see the String Translation screen of the WPML admin. I've filtered this to show the ACF field group in question (acf-field-group-69). You will see by the + signs next to these items that I've provided translations for them. I've expanded the "Corporate Services" item to show the provided translation.

================
Dutch Translated Page
hidden link

In the final panel of the attached image, you'll see the translated version of the page. The content above the "Divisions" list has been translated, but the labels for the choices have not been translated.

================
Questions

1. What am I doing wrong?
2. What information do you need from me besides what I've provided?

Translating Checkbox Labels - small.jpg
December 11, 2023 at 5:13 am #15032809

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello @johnM-108,

Thank you for the detailed information.

I would like to know two things more so can you please provide feedback on it?

1. What are the Translation preferences set for field Division? Can you set it to copy and see if it helps?

2. How are the checkboxes shown on the front end, are you using PHP code or some plugins?

Look forward to your reply.

Thanks

December 11, 2023 at 2:33 pm #15038539

johnM-108

Thanks for your response.

1. The field was already set to Copy (see attachment).

2. The front end is being generated by a custom coded theme. The team_division Advanced Custom Field's "Return Value" is set to "Both (Array)" because I'm using both the Value and the Label in the code.

Let me know if you want to see the code. I'm simply iterating over the array the ACF field returns.

team_division - Return Value.png
team_division - Copy.png
December 11, 2023 at 2:47 pm #15038719

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

To debug this issue further, I would need to check your site settings once, for this I would need temporary access (wp-admin and ftp) to your site.

So could you please provide me with those details, you will find the needed fields for this below the comment area when you log in to leave your next reply.
hidden link

This info is private and available to you and WPML supporters only.
Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note:
Backup your sites before providing the credentials or if possible provide credentials for the test site

Look forward to your reply.

Thanks

December 12, 2023 at 5:05 am #15041783

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

It seems like I don't have permissions to view the plugins as well as edit theme files, which is required here to debug the issue further, being so can you upgrade my account to have those privileges and if possible provide ftp details.

Look forward to your reply.

Thanks

December 13, 2023 at 2:29 pm #15056033

johnM-108

I've updated the information in the private message.

December 14, 2023 at 7:57 am #15060895

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

I deleted the string translations from your site to test the issue further, it resulted in more errors due to the way the theme is set up but I managed to get it back.

I then set up a fresh new setup with ACF and tested it there and it worked without any issues.

After a lot of debugging, I managed to find out that the issue was due to acf-json being used on the site.

So to fix the issue, please follow the below steps:

- Go to ACF->Tools and enable " Scan local fields for changes to translation preferences." and save hidden link
- - Go to WPML->Strings Translations->Auto Register strings for translations
- Enable the "Look for strings while pages are rendered" option
- Now visit the page on front-end where the string is shown, this will automatically register strings from that page
- Now go to WPML->Strings Translations->Auto Register strings for translations and disable the options
- Search for the strings in WPML->String Translations and translate it, there will be more than 1 or 2 instances, so translate all of them.

Let me know if this helps.

Thanks

December 14, 2023 at 6:14 pm #15067937

johnM-108

Shekar -- This looks like it's working. It's hard following along what's going on, but at this point I'll just take it working.

Questions:
1) Regarding the "WPML > String Translation > Auto register strings for translation > Look for strings while pages are rendered" setting, am I correct in assuming I should only turn this on briefly to capture these items and then turn it off?
2) Same question with the "ACF > Tools > Scan local fields for changes to translation preferences"?

Please, don't close this ticket until I can give this a shot on the production environment, which I will need to coordinate with my team.

Thank you for the help, this has been a tough one.

December 14, 2023 at 6:21 pm #15067965

johnM-108

Shekar -- I will be performing this on our production environments early on Saturday morning EST time in the USA. If things go well, I'll come here and close the ticket. Thank you.

December 15, 2023 at 5:30 am #15069517

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Questions:
1) Regarding the "WPML > String Translation > Auto register strings for translation > Look for strings while pages are rendered" setting, am I correct in assuming I should only turn this on briefly to capture these items and then turn it off?
2) Same question with the "ACF > Tools > Scan local fields for changes to translation preferences"?

Yes.

Sure, the ticket will be opened for a week without any activity.

Thanks

December 18, 2023 at 2:41 pm #15085239

johnM-108

Shekhar,

This issue is resolved. Your solution worked, but in-case it helps someone else who might find this thread, I came-up with another solution as well.

Instead of relying on WPML to handle the translation of the checkbox label in the described fashion, I used the _e( $label, $domain ) function and then added the string translations myself.

Regardless, thank you for the help. I'm happy to close this ticket!