Skip Navigation

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

Problem:

The module ACF Item Divi Machine is not translated correctly.

Solution:

1- Open the (app/public/wp-content/plugins/divi-machine/includes/modules/ACFItem/ACFItem.php) file
2- Look for the following snippet at line 3879:

else if (in_array($acf_type, $choice_acf_choice_types_explode)) {
  if ($acf_get['value']) :
    ?>

With the following

else if (in_array($acf_type, $choice_acf_choice_types_explode)) {
  if ($acf_get['value']) :

    // WPML Workaround for compsupp-7040
    if (class_exists('Sitepress')) {
      $textdomain = 'WordPress';
      $wpml_default_lang = apply_filters('wpml_default_language', NULL);
      $wpml_current_lang = apply_filters('wpml_current_language', NULL);


      if (is_array($acf_get['value'])) {
          // Iterate over each item in the array
          foreach ($acf_get['value'] as &$valueItem) {
              $string_name = 'WPML Workaround : ' . substr($valueItem, 0, 20);

              if ($wpml_default_lang == $wpml_current_lang) {
                  do_action('wpml_register_single_string', $textdomain, $string_name, $valueItem);
              }

              // Apply the translation to the string
              $valueItem = apply_filters('wpml_translate_single_string', $valueItem, $textdomain, $string_name);
          }
      } else {
          $string = $acf_get['value'];
          $string_name = 'WPML Workaround : ' . substr($string, 0, 20);

          if ($wpml_default_lang == $wpml_current_lang) {
              do_action('wpml_register_single_string', $textdomain, $string_name, $string);
          }

          // Apply the translation to the string
          $acf_get['value'] = apply_filters('wpml_translate_single_string', $string, $textdomain, $string_name);
      }
    }

  ?>

3- Visit the page in the original language to register the strings
4- Translate the strings in WPML String Translator

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 11 replies, has 3 voices.

Last updated by robinV-14 1 year, 5 months ago.

Assisted by: Osama Mersal.

Author Posts
October 28, 2023 at 11:22 am

robinV-14

Hi Support,

I need some help with translations that are not working correctly.

I use Divi Engine, WPML and ACF. Now everything is translated correct at the back-end in WPML but all the values of the Divi Engine strings are not showing the right translation. It only shows the default language in this case.

This happens in lay-outs/modules that are loaded via a Archive loop f.e. I also have translated these lay-out in the divi library already. See screenshot below:

The left side (module filter posts) is the filter options that are being shown correctly (in Dutch). The right is the item that is not shown correctly (it is a Archive Loop module). Both are the same fields in ACF.

Sow, the module ACF Item Divi Machine is not translated correct.

October 28, 2023 at 1:03 pm
October 29, 2023 at 11:08 am #14686209

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

I need your permission to install the Duplicator Pro plugin to take a local copy of your site to debug the issue without affecting your live site and escalate if needed.

Best regards,
Osama

October 29, 2023 at 1:33 pm #14686669

robinV-14

Permission granted.

October 29, 2023 at 2:50 pm #14686823

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for your permission. I replicated the issue on a fresh installation. Please check it and confirm this is the same issue on your site.

Sandbox login: hidden link

Test Page: hidden link

After your confirmation, I'll consult our compatibility team regarding the issue with the Divi machine plugin.

Best regards,
Osama

October 29, 2023 at 2:59 pm #14686861

robinV-14

Yes, you replicated it.

October 29, 2023 at 3:13 pm #14686863

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I've consulted our compatibility team, and I'll update you as soon as I get their reply.

Thanks for your patience.

Best regards,
Osama

November 1, 2023 at 2:49 pm #14708395

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for your patience. Our compatibility team has found a workaround for this issue.

1- Open the (app/public/wp-content/plugins/divi-machine/includes/modules/ACFItem/ACFItem.php) file
2- Look for the following snippet at line 3879:

else if (in_array($acf_type, $choice_acf_choice_types_explode)) {
  if ($acf_get['value']) :
    ?>

With the following

else if (in_array($acf_type, $choice_acf_choice_types_explode)) {
  if ($acf_get['value']) :

    // WPML Workaround for compsupp-7040
    if (class_exists('Sitepress')) {
      $textdomain = 'WordPress';
      $wpml_default_lang = apply_filters('wpml_default_language', NULL);
      $wpml_current_lang = apply_filters('wpml_current_language', NULL);


      if (is_array($acf_get['value'])) {
          // Iterate over each item in the array
          foreach ($acf_get['value'] as &$valueItem) {
              $string_name = 'WPML Workaround : ' . substr($valueItem, 0, 20);

              if ($wpml_default_lang == $wpml_current_lang) {
                  do_action('wpml_register_single_string', $textdomain, $string_name, $valueItem);
              }

              // Apply the translation to the string
              $valueItem = apply_filters('wpml_translate_single_string', $valueItem, $textdomain, $string_name);
          }
      } else {
          $string = $acf_get['value'];
          $string_name = 'WPML Workaround : ' . substr($string, 0, 20);

          if ($wpml_default_lang == $wpml_current_lang) {
              do_action('wpml_register_single_string', $textdomain, $string_name, $string);
          }

          // Apply the translation to the string
          $acf_get['value'] = apply_filters('wpml_translate_single_string', $string, $textdomain, $string_name);
      }
    }

  ?>

3- Visit the page in the original language to register the strings
4- Translate the strings in WPML String Translator

I've applied this workaround on the sandbox site. Please check it and let me know if it works correctly.

It would be great if you could contact the authors and urge them to join our Go Global Program.
You can find details about it here. (https://wpml.org/documentation/theme-compatibility/go-global-program/)

Best regards,
Osama

November 1, 2023 at 3:55 pm #14708991

robinV-14

HI Osama,

Have tested it in the sandbox and it works perfectly now! Many thanks to you and the compatibility team! Closing this ticket now.

November 1, 2023 at 3:56 pm #14708993

robinV-14

Have tested it in the sandbox and it works perfectly now! Many thanks to you and the compatibility team! Closing this ticket now.

November 1, 2023 at 4:39 pm #14709229

robinV-14

Hi Osama,

I see that not all the ACF fields are available for translating. This is the complete list:

Category
Finance
Business Support
Customer Support
Human Resources
Sales & Marketing
IT
Operations (Auditors)
Operations (Inspectors)
Management
Experience
Starter 0-2 years
Professional 3-6 year
Experienced 7+ years
Employment type
Permanent
Temporary
Contractor/Freelancer
Internship/Trainee
Country
Belgium
Netherlands
France
Germany
Austria
Poland
Spain
Portugal
Czech Republic
Denmark
Hungary
Ireland
Italy
Luxembourg
Romania
Sweden
Switzerland
Turkey
United Kingdom
Greece

How can I add this ones to the 'WPML Workaround' string translations?

November 2, 2023 at 9:50 am #14714791

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi there,

Osama is off today, so I am taking care of this ticket, hope that is OK. 🙂

As I can see in the sandbox test site, all strings are registered and translated:

- hidden link

Can you please check again the sandbox website and share with us how can we see the issue there, so we can check and help further.

Regards,
Drazen

November 2, 2023 at 8:15 pm #14721109

robinV-14

Hi Drazen,

Ah, I think I first had to publish a new post with the missing strings activated in it. Now I see them. Thanks!