Support

Home Forums Event Espresso Premium translating filters for events table

translating filters for events table

Posted: January 12, 2018 at 3:49 am

Viewing 3 reply threads


Oguzhan Altun

January 12, 2018 at 3:49 am

Hello,

I had the filters for the events table translated for the french version of our French website (/fr/) with the following code:

	<?php
		if (strpos($url,'/fr/') !== false) { ?>
       
	  <option value="showall" class="ee_filter_show_all"><?php echo __('Tous les Cours', 'event_espresso'); ?></option>
       <?php } else { ?>
	    <option value="showall" class="ee_filter_show_all"><?php echo __('All Courses', 'event_espresso'); ?></option>
       <?php
       }
		
		 
		$taxonomy = array('espresso_event_categories');
		$args = array('orderby'=>'name','hide_empty'=>true);
		$ee_terms = get_terms($taxonomy, $args);
		foreach($ee_terms as $term){
			 
			 
			 if (strpos($url,'/fr/') !== false) {
			 
					   if($term->name == 'Beginners-Half Day'){
						   $termname = 'Débutants-Demi Journée';  
					   }

I would like to apply the same code to our german website. The problem is that in the german website, the root is in german and the english version is under /en/ subfolder.

How do I adopt this code to show german versions under the root?

I tried changing the /fr/ to /en/ and “false” to “true” but it doesn’t work.
Then I changed /fr/ to /en/, left false as false, then I could update the first section for “all courses”. But this trick doesn’t work the category names (e.g. Beginners-HalfDay).

Thanks in advance for your help.


Oguzhan Altun

January 12, 2018 at 4:07 am

Just to clarify the question, for the event categories, how can I change the below code

if (strpos($url,'/fr/') !== false)

to: If the url does not include /en/ then…

Then I can use the below code to translate the english category names to german. for ex:

if($term->name == 'Beginners-Half Day'){
   $termname = 'Anfänger Halbtages Fotografiekurs'; 

Hope that explains better.


Josh

  • Support Staff

January 12, 2018 at 7:57 am

May I ask how exactly are you setting the $url variable?


Oguzhan Altun

January 12, 2018 at 9:22 am

That’s what I could find:
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];

The full template is here.

Viewing 3 reply threads

The support post ‘translating filters for events table’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso