Please make sure to update to WPML 4.3.6 and check our list of Known Issues before reporting

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 1 reply, has 2 voices.

Last updated by Shekhar Bhandari 2 years, 7 months ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
June 26, 2017 at 10:42 pm #1306055

davidA-29

I am trying to:

Translate a string in custom code included from a child theme via require_once(). The code resides in a symlinked mu-plugins folder outside the site root.

URL of (my) website where problem appears:
hidden link

I expected to see:
The DE translation of 'Additional information' (you'd need to add something to the cart to get it to show).

Instead, I got:
Untranslated 'Additional information'.

Steps to duplicate the issue:

My child theme is at
/var/www/mu/zzz/wp-content/themes/wooint

The mu-plugins folder is symlinked from
/var/www/mu/zzz/wp-content/

The include from my child theme is
require_once('/var/www/zzz/live/mu-plugins/shared/woo.php');

Strings in woo.php are not being picked up for translation.

The only mention of mu-plugins I can see is in Theme and plugins localization -> Strings in the plugins - > MU :: load.php.

However, MU :: load.php does not include the code at /var/www/zzz/live/mu-plugins/shared/woo.php - only the child theme does this.

When I scan the themes I see the file that includes the call to require_once('/var/www/zzz/live/mu-plugins/shared/woo.php') is scanned, but it's not following the require_once and so not finding my string.

June 27, 2017 at 1:00 am #1306089

Shekhar Bhandari
Supporter

Languages: English (English )

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

Hello @davida-29,

Thank you for contacting WPML support. I'd be happy to help you on this.

I would like to look at the code to further debug this issue, so to further debug this issue, I need to request temporary access (wp-admin and FTP) to your site in order to be of better help. 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 supporters only. Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note that:
+ Backup (both files and database) your site before giving us your credentials
+ It would be better if you give me the test site rather than the live site.

We'd like to request the permission to disable, enable and install themes and plugins for this site. Please accept this?

Look forward to your reply.

Thanks

The topic ‘[Closed] Cannot translate string in custom code’ is closed to new replies.