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 thread is resolved. Here is a description of the problem and solution.

Problem: Unable to translate string in function.php of my child theme. This code has been added in the function.php of my child theme, WPML don't find the string.

Solution: Solution here: https://wpml.org/forums/topic/translate-strings-function-php-child-theme/#post-2207051

This topic contains 2 replies, has 2 voices.

Last updated by genevieveR-2 1 year, 4 months ago.

Assigned support staff: Noman.

Author Posts
May 21, 2018 at 4:07 pm #2202652

genevieveR-2

Tell us what you are trying to do?

I try to translate these strings in function.php of my child theme 'I am looking for a job!' and 'I have jobs to offer!'.

This code has been add in the function.php of my child theme, WPML don t find the string

function custom_jobify_registration_role_candidate() {
return 'I am looking for a job!';
}
add_filter( 'jobify_registration_role_candidate', 'custom_jobify_registration_role_candidate' );

function custom_jobify_registration_role_employer() {
return 'I have jobs to offer!';
}
add_filter( 'jobify_registration_role_employer', 'custom_jobify_registration_role_employer' );

Is there any documentation that you are following?
hidden link

What is the link to your site

hidden link

I can sent you an access if needed

May 22, 2018 at 10:27 am #2207051

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. I have wrap the string in the gettext functions __() with a text domain like 'themedomain’. Please use updated code:

function custom_jobify_registration_role_candidate() {
return __('I am looking for a job!', 'themedomain');
}
add_filter( 'jobify_registration_role_candidate', 'custom_jobify_registration_role_candidate' );

function custom_jobify_registration_role_employer() {
return __('I have jobs to offer!', 'themedomain');
}
add_filter( 'jobify_registration_role_employer', 'custom_jobify_registration_role_employer' );

Then, scan the theme again in WPML >> Theme and plugins localization and translate this string under WPML >> String Translation

Thank you

May 25, 2018 at 2:12 am #2226560

genevieveR-2

Thanks you soo much you really resolve my issue !!