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

Problem: How to translate the breadcrumb in Genesis Child theme.

Solution: You need to register the breadcrumb strings to String Translation module so that you can translate them to other languages via Sting Translation page.

Register the string using a function like this add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' ); function sp_breadcrumb_args( $args ) { $args['home'] = _x('Home', 'wpml_custom_breadcrumb_home', 'wpml_custom'); $args['labels']['prefix'] = _x('You are Here: ', 'wpml_custom_breadcrumb_prefix', 'wpml_custom'); return $args; } After that, you can go to String Translation page and translate them, but make sure that you have enabled Translate using WPML option in Theme and plugins localization page

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

Last updated by angelaW 5 years, 6 months ago.

Assigned support staff: Ahmed Mohammed.

Author Posts
September 11, 2014 at 9:15 am #468330

angelaW

I am trying to translate our breadcrumb trail in our Genesis Child theme in WordPress. In English our trail looks like this:
You are here: Home
Using the following php:

//* Translating breadcrumb trail
add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' );
function sp_breadcrumb_args( $args ) {
	$args['home'] = icl_translate( 'wpml_custom', 'wpml_custom_breadcrumb', 'Home' );
	$args['labels']['prefix'] = 'You are here: ' ;
return $args;
}

We've translated the "Home" link which is great. However I also want to send the "You are here label" to string translation so we can translate it as well. I tried using

icl_translate( 'wpml_custom', 'wpml_custom_breadcrumb', 'You are Here: ' );

but it just gave me two homes ... which makes sense as I'm really saying the same thing twice 🙂
Any help would be appreciated! Thank you!

September 11, 2014 at 1:42 pm #468678

Ahmed Mohammed
Supporter

Timezone: Europe/Rome (GMT+01:00)

Thanks for contacting us, I'll help in this.

Can you please wrap that string as the following:

__('You are Here: ', 'some_context');

Then you need to translate this string via String Translation page under "some_context" context 🙂

Please let me know if that help.

September 11, 2014 at 2:13 pm #468719

angelaW

Hi Ahmed,

That allowed me to translate it in the string translations so I added a french translation but it's not showing up on the front end. My php now looks like this:

//* Translating breadcrumb trail
add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' );
function sp_breadcrumb_args( $args ) {
	$args['home'] = icl_translate( 'wpml_custom', 'wpml_custom_breadcrumb', 'Home' );
	$args['labels']['prefix'] = __('You are Here: ', 'some_context');
return $args;
}

What have I missed? 🙂

Thank you for your help!

September 12, 2014 at 9:21 am #469427

Ahmed Mohammed
Supporter

Timezone: Europe/Rome (GMT+01:00)

Well, can you please try this,

add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' );
function sp_breadcrumb_args( $args ) {
    $args['home'] = _x('Home', 'wpml_custom_breadcrumb_home', 'wpml_custom');
    $args['labels']['prefix'] = _x('You are Here: ', 'wpml_custom_breadcrumb_prefix', 'wpml_custom');
return $args;
}

Let's try not mixing icl_translate with __(

Please let me know when you're done.

September 12, 2014 at 9:42 am #469451

angelaW

Hi Ahmed,

That didn't work either. With that code I could see the Breadcrumb ('Home') in String Translations and translated it into French but when I go to the front end both the 'You are here' and 'Home' slugs are still in English. Sorry,

We do have the build in a test site with wpml and some translations which I can give you access to if that helps?

September 12, 2014 at 1:44 pm #469724

Ahmed Mohammed
Supporter

Timezone: Europe/Rome (GMT+01:00)

Yeah that would be great, 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. The information you will enter is private which means only you and I can see and have access to it.

+ Please make sure that you have a full backup of your website and database. (Please don't ignore this)!
+ It'd be great if you give me an access for a test site where the problem is replicated.

September 12, 2014 at 2:55 pm #469817

Ahmed Mohammed
Supporter

Timezone: Europe/Rome (GMT+01:00)

Thanks for the info, actually I could see the first combination and I couldn't see the second combination. You can write them in comment area, it's also private.

September 12, 2014 at 3:23 pm #469863

Ahmed Mohammed
Supporter

Timezone: Europe/Rome (GMT+01:00)

Thanks for the info, I could access the WP login page but the WP login info is incorrect!

Can you please have a look ? 🙂

September 12, 2014 at 3:41 pm #469894

angelaW

Hi Ahmed:

I've reset the login information and just tried it and it works like a charm!

September 12, 2014 at 3:44 pm #469895

Ahmed Mohammed
Supporter

Timezone: Europe/Rome (GMT+01:00)

Yeah, working now like a charm!

I'll update you when I'm done, Thanks!

September 12, 2014 at 3:51 pm #469905

Ahmed Mohammed
Supporter

Timezone: Europe/Rome (GMT+01:00)

Thanks for the info.

I've enabled Translate by WPML option in Theme and plugins localization page, then scanned theme for strings and translated the string via String Translation page.

Please let me know if that helps!

September 15, 2014 at 8:31 am #470834

angelaW

Thank you Ahmed!
That works perfectly! Yet another case of me not seeing the forest because I'm focused on the PHP tree 🙂 That's much easier and also answers the question of how we can translate widgets etc. in the back end!
Greatly appreciate your help!