Skip to main content
Le panier est vide

How to translate The Event Calendar

To Translate the event calendar plugin the lite version of Falang for Wordpress is enought.

You can see bellow a site with 2 languages French ang English, the default language is French with English translation. In the picture bellow you can see 2 events with a translation for the first event in english published (green circle)

Event if the translation can be done in backend , to be visible in frontend you have to enabled it in Falang > Settings > Translate options and check the Events Custom Post Type 

After saving it , you have access to the option of this CPT. you can set your own slug for this event or use the default one. 

If you have a 404 in front end you can save another time the permalink Settings > Permalink

You can see the result in the front-end Widget BUT the view Calendar link don't work due to permalink problem.

You can fix the permalink problem with custom code in the function.php of your template add the following code

The code need to be modified with your language and the slug you use (:fr|en) is for french fr , english en

function tribe_rewrite_canonical_url ($resolved, $url, $cl_rewrite_tribe ){
if (isset($resolved)){
 $resolved = str_replace('(/?:fr/|en/)/?','',$resolved);
}
 return $resolved;
}

add_filter( 'tribe_rewrite_canonical_url', 'tribe_rewrite_canonical_url', 10, 3 );

The link in the calendar view (in this exemple event is the slug for translation and not tribe_events

function falang_post_type_link ($post_link, $post, $leavename, $sample){
  if (isset($post) && $post->post_type == 'tribe_events'){
    $post_link = str_replace('%tribe_events-slug%','event',$post_link);
  }
  return $post_link;
}

add_filter( 'post_type_link', 'falang_post_type_link', 10, 4 );//set 11 instead of 10 if you use Divi